Commands
This package contains tests of the integreat_cms.core.management.commands
module
Test Duplicate Pages
- tests.core.management.commands.test_duplicate_pages.test_duplicate_pages(settings: SettingsWrapper, load_test_data: None) None [source]
Ensure that pages are really duplicated
- Parameters:
settings (SettingsWrapper)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_duplicate_pages.test_duplicate_pages_missing_region_slug(settings: SettingsWrapper) None [source]
Ensure that a missing region slug throws an error
- Parameters:
settings (SettingsWrapper)
- Return type:
None
Test Find Large Files
- tests.core.management.commands.test_find_large_files.test_find_large_files() None [source]
Ensure that finding large files works
- Return type:
None
- tests.core.management.commands.test_find_large_files.test_find_large_files_exceeding_limit() None [source]
Ensure that a too high limit throws an error
- Return type:
None
- tests.core.management.commands.test_find_large_files.test_find_large_files_invalid_limit() None [source]
Ensure that a negative limit throws an error
- Return type:
None
- tests.core.management.commands.test_find_large_files.test_find_large_files_invalid_threshold() None [source]
Ensure that a negative threshold throws an error
- Return type:
None
Test Find Missing Versions
- tests.core.management.commands.test_find_missing_versions.test_find_missing_versions_failure(load_test_data: None) None [source]
Ensure that inconsistencies are listed
- Parameters:
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_find_missing_versions.test_find_missing_versions_invalid_model() None [source]
Ensure that an invalid model throws an error
- Return type:
None
Test Fix Internal Links
- tests.core.management.commands.test_fix_internal_links.test_fix_internal_links_commit(load_test_data_transactional: Any | None) None [source]
Ensure that committing changes to the database works as expected
- Parameters:
load_test_data_transactional (Any | None) – The fixture providing the test data (see
load_test_data_transactional()
)- Return type:
None
- tests.core.management.commands.test_fix_internal_links.test_fix_internal_links_dry_run(load_test_data_transactional: Any | None) None [source]
Ensure that dry run works as expected
- Parameters:
load_test_data_transactional (Any | None) – The fixture providing the test data (see
load_test_data_transactional()
)- Return type:
None
- tests.core.management.commands.test_fix_internal_links.test_fix_internal_links_non_existing_region(load_test_data: None) None [source]
Ensure that a non existing region slug throws an error
- Parameters:
load_test_data (None) – The fixture providing the test data (see
load_test_data()
)- Return type:
None
- tests.core.management.commands.test_fix_internal_links.test_fix_internal_links_non_existing_username(load_test_data: None) None [source]
Ensure that a non existing username throws an error
- Parameters:
load_test_data (None) – The fixture providing the test data (see
load_test_data()
)- Return type:
None
Test Hix Bulk
Test Import Events
- tests.core.management.commands.test_import_events.serve(server: HTTPServer, file: str) str [source]
Serves the given file :param server: The server :param file: The file to serve :return: The url of the served file
- Parameters:
server (HTTPServer)
file (str)
- Return type:
- tests.core.management.commands.test_import_events.setup_calendar(url: str) ExternalCalendar [source]
Creates a Calendar instance :param url: The url of the external calendar :return: An External Calendar object
- Parameters:
url (str)
- Return type:
- tests.core.management.commands.test_import_events.test_delete_event(httpserver: HTTPServer, load_test_data: None) None [source]
Tests that an event gets deleted if it is deleted in the ical file :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
)- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_import_events.test_import_corrupted_event(httpserver: HTTPServer, load_test_data: None) None [source]
Tests that an invalid event gets handled correctly and does not cause the command to crash :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
)- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_import_events.test_import_event_with_correct_tag(httpserver: HTTPServer, load_test_data: None) None [source]
Tests that an event gets imported if it has the right tag :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
)- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_import_events.test_import_event_with_multiple_categories(httpserver: HTTPServer, load_test_data: None) None [source]
Tests that an event does not get imported if it has multiple category definitions :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
)- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_import_events.test_import_event_with_wrong_tag(httpserver: HTTPServer, load_test_data: None) None [source]
Tests that an event does not get imported if it does not have the right tag :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
)- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_import_events.test_import_event_without_tags(httpserver: HTTPServer, load_test_data: None) None [source]
Tests that an event does not get imported if it does not have tags, but tags are required :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
)- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_import_events.test_import_successful(httpserver: HTTPServer, load_test_data: None, calendar_data: tuple[str, list[str]]) None [source]
Tests that the calendars in the test data can be imported correctly :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
) :param calendar_data: A tuple of calendar path and event names of this calendar- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_import_events.test_import_without_calendars() None [source]
Tests that the import command does not fail if no external calendars are configured
- Return type:
None
- tests.core.management.commands.test_import_events.test_update_event(httpserver: HTTPServer, load_test_data: None) None [source]
Tests that an event gets updated if it is updated in the ical file :param httpserver: The server :param load_test_data: The fixture providing the test data (see
load_test_data()
)- Parameters:
httpserver (HTTPServer)
load_test_data (None)
- Return type:
None
Test Repair Tree
Test repair tree management command
Test execution order:
Since there seem to be some weird side effects happening
for unrelated tests when testing database consistency, we first run those,
then the tests that make sure the repair_tree()
is effective,
and last the effectiveness of tree_mutex()
itself.
This ordering is facilitated using pytest_order
to specify the tests to run "last"
(eqivalent to -1
, absolute ordering)
and after certain other tests (relative ordering).
See https://pytest-order.readthedocs.io/en/stable/usage.html#order-relative-to-other-tests
- tests.core.management.commands.test_repair_tree.test_check_broken_tree_fields(load_test_data_transactional: None) None [source]
Introduce an error to the test data and ensure it is found.
- Parameters:
load_test_data_transactional (None)
- Return type:
None
- tests.core.management.commands.test_repair_tree.test_check_clean_tree_fields(load_test_data_transactional: None) None [source]
Ensure no errors are found in default test data.
- Parameters:
load_test_data_transactional (None)
- Return type:
None
Test Replace Links
- tests.core.management.commands.test_replace_links.test_replace_links_commit(load_test_data_transactional: Any | None) None [source]
Ensure that committing changes to the database works as expected
- Parameters:
load_test_data_transactional (Any | None) – The fixture providing the test data (see
load_test_data_transactional()
)- Return type:
None
- tests.core.management.commands.test_replace_links.test_replace_links_dry_run(load_test_data_transactional: Any | None) None [source]
Ensure that dry run works as expected
- Parameters:
load_test_data_transactional (Any | None) – The fixture providing the test data (see
load_test_data_transactional()
)- Return type:
None
- tests.core.management.commands.test_replace_links.test_replace_links_missing_args() None [source]
Ensure that missing args cause an error
- Return type:
None
- tests.core.management.commands.test_replace_links.test_replace_links_missing_replace() None [source]
Ensure that a missing replace throws an error
- Return type:
None
- tests.core.management.commands.test_replace_links.test_replace_links_non_existing_region(load_test_data: None) None [source]
Ensure that a non existing region slug throws an error
- Parameters:
load_test_data (None) – The fixture providing the test data (see
load_test_data()
)- Return type:
None
- tests.core.management.commands.test_replace_links.test_replace_links_non_existing_username(load_test_data: None) None [source]
Ensure that a non existing username throws an error
- Parameters:
load_test_data (None) – The fixture providing the test data (see
load_test_data()
)- Return type:
None
Test Reset Deepl Budget
- class tests.core.management.commands.test_reset_deepl_budget.datetime_not_first_day[source]
Bases:
object
Fake datetime object where now() is never the first day of the month
Test Send Push Notifications
- class tests.core.management.commands.test_send_push_notifications.TestSendPushNotification[source]
Bases:
object
Test that cover the send_push_notification management command and its filter mechanisms
Test SUMM.AI Bulk
- tests.core.management.commands.test_summ_ai_bulk.test_summ_ai_bulk_disabled(settings: SettingsWrapper, load_test_data: None) None [source]
Ensure that calling when globally disabled throws an error
- Parameters:
settings (SettingsWrapper)
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_summ_ai_bulk.test_summ_ai_bulk_disabled_region(load_test_data: None) None [source]
Ensure that calling when disabled in a region throws an error
- Parameters:
load_test_data (None)
- Return type:
None
- tests.core.management.commands.test_summ_ai_bulk.test_summ_ai_bulk_missing_args() None [source]
Ensure that missing args cause an error
- Return type:
None
- tests.core.management.commands.test_summ_ai_bulk.test_summ_ai_bulk_missing_username() None [source]
Ensure that a missing username throws an error
- Return type:
None