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

tests.core.management.commands.test_duplicate_pages.test_duplicate_pages_non_existing_region(settings: SettingsWrapper) None[source]

Ensure that a non existing region slug throws an error

Parameters:

settings (SettingsWrapper)

Return type:

None

tests.core.management.commands.test_duplicate_pages.test_duplicate_pages_prod() None[source]

Ensure that this command does not work in production mode

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

tests.core.management.commands.test_find_large_files.test_find_large_files_valid_limit() None[source]

Ensure that changing the limit works

Return type:

None

tests.core.management.commands.test_find_large_files.test_find_large_files_valid_threshold() None[source]

Ensure that increasing the threshold works

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

tests.core.management.commands.test_find_missing_versions.test_find_missing_versions_missing_model() None[source]

Ensure that missing model cause an error

Return type:

None

tests.core.management.commands.test_find_missing_versions.test_find_missing_versions_success(load_test_data: None, model: str) None[source]

Ensure no errors are found in default test data

Parameters:
  • load_test_data (None)

  • model (str)

Return type:

None

Test Hix Bulk

tests.core.management.commands.test_hix_bulk.test_hix_bulk_bulk_non_existing_region(settings: SettingsWrapper) None[source]

Ensure that a non existing region slug throws an error

Parameters:

settings (SettingsWrapper)

Return type:

None

tests.core.management.commands.test_hix_bulk.test_hix_bulk_textlab_api_disabled(settings: SettingsWrapper) None[source]

Ensure that a disabled textlab api causes an error

Parameters:

settings (SettingsWrapper)

Return type:

None

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:
Return type:

str

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:

ExternalCalendar

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:
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:
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:
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:
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:
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:
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:
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:
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

tests.core.management.commands.test_repair_tree.test_fix_broken_tree_fields(load_test_data_transactional: None) None[source]

Introduce an error to the test data and ensure it is fixed.

Parameters:

load_test_data_transactional (None)

Return type:

None

tests.core.management.commands.test_repair_tree.test_fix_clean_tree_fields(load_test_data_transactional: None) None[source]

Ensure no errors need to be fixed in default test data.

Parameters:

load_test_data_transactional (None)

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

classmethod now() datetime[source]

generate a date with day=2

Returns:

a date which is never the 1st day of the month

Return type:

datetime

tests.core.management.commands.test_reset_deepl_budget.test_not_first_day() None[source]

Ensure that the command will not run when it’s not the 1st day of the month without –force

Return type:

None

tests.core.management.commands.test_reset_deepl_budget.test_reset_mt_budget(load_test_data_transactional: Any | None) None[source]

Ensure that MT budget gets reset successfully

Parameters:

load_test_data_transactional (Any | None)

Return type:

None

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_push_notifications_disabled(settings: SettingsWrapper) None[source]

Ensure that disabled push notifications cause an error

Parameters:

settings (SettingsWrapper)

Return type:

None

test_push_notifications_nonexisting_testregion(settings: SettingsWrapper) None[source]

Ensure that an error is caused when the system runs in debug mode but the test region does not exist

Parameters:

settings (SettingsWrapper)

Return type:

None

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

tests.core.management.commands.test_summ_ai_bulk.test_summ_ai_bulk_non_existing_region() None[source]

Ensure that a non existing region slug throws an error

Return type:

None

tests.core.management.commands.test_summ_ai_bulk.test_summ_ai_bulk_non_existing_username(load_test_data: None) None[source]

Ensure that a non existing username throws an error

Parameters:

load_test_data (None)

Return type:

None