Utils
This package contains tests for the integreat_cms.cms.utils
package.
Test Content Utils
Test Disable Hix Post Save Signal
- tests.cms.utils.test_disable_hix_post_save_signal.create_dummy_page_translation(dummy_region: Region) PageTranslation [source]
- Parameters:
dummy_region (Region)
- Return type:
- tests.cms.utils.test_disable_hix_post_save_signal.dummy_region(django_db_setup: None, django_db_blocker: _DatabaseBlocker) Region [source]
Fixture to create a dummy region, along with a dummy language.
- Parameters:
django_db_setup (None)
django_db_blocker (_DatabaseBlocker)
- Return type:
Test Internal Link Checker
- tests.cms.utils.test_internal_link_checker.prepage_url(link: str, trailing_slash: bool) Url [source]
Make sure a link either has or doesn’t have a trailing slash
- tests.cms.utils.test_internal_link_checker.test_check_internal_invalid(load_test_data: None, link: str, trailing_slash: bool) None [source]
Check whether the given internal URL is correctly identified as invalid link
- Parameters:
load_test_data (None) – The fixture providing the test data (see
load_test_data()
)link (str) – The URL to check
trailing_slash (bool) – Whether to ensure the trailing slash
- Return type:
None
- tests.cms.utils.test_internal_link_checker.test_check_internal_skipped(load_test_data: None, link: str, trailing_slash: bool) None [source]
Check whether the given internal URL is correctly skipped
- Parameters:
load_test_data (None) – The fixture providing the test data (see
load_test_data()
)link (str) – The URL to check
trailing_slash (bool) – Whether to ensure the trailing slash
- Return type:
None
- tests.cms.utils.test_internal_link_checker.test_check_internal_valid(load_test_data: None, link: str, trailing_slash: bool) None [source]
Check whether the given internal URL is correctly identified as valid link
- Parameters:
load_test_data (None) – The fixture providing the test data (see
load_test_data()
)link (str) – The URL to check
trailing_slash (bool) – Whether to ensure the trailing slash
- Return type:
None
Test Repair Tree
Test repair tree util
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.cms.utils.test_repair_tree.test_repair_tree(load_test_data_transactional: None) None [source]
Create a broken tree of 3 nodes and assert that
repair_tree()
correctly fixes it.- Parameters:
load_test_data_transactional (None)
- Return type:
None
- tests.cms.utils.test_repair_tree.test_repair_tree_complex(load_test_data_transactional: None) None [source]
Recreate a real-world example of a broken tree and assert that
repair_tree()
correctly fixes it.- Parameters:
load_test_data_transactional (None)
- Return type:
None
Test Rounded Hix Value
Test Slug Utils
- tests.cms.utils.test_slug_utils.test_generate_unique_slug_fallback(settings: SettingsWrapper, load_test_data: None) None [source]
Test whether the
generate_unique_slug_helper()
function correctly uses the fallback property when no slug is provided- Parameters:
settings (SettingsWrapper)
load_test_data (None)
- Return type:
None
- tests.cms.utils.test_slug_utils.test_generate_unique_slug_no_fallback() None [source]
Test whether the
generate_unique_slug_helper()
throws adjango.core.exceptions.ValidationError
, while the fallback property does not exist- Return type:
None
- tests.cms.utils.test_slug_utils.test_generate_unique_slug_reserved_page_slug(settings: SettingsWrapper, load_test_data: None) None [source]
Test whether the
generate_unique_slug_helper()
function function returns the correct unique slug when the new page slug is a reserved slug- Parameters:
settings (SettingsWrapper)
load_test_data (None)
- Return type:
None
- tests.cms.utils.test_slug_utils.test_generate_unique_slug_reserved_region_slug(settings: SettingsWrapper, load_test_data: None) None [source]
Test whether the
generate_unique_slug_helper()
function returns the correct unique slug when the new region slug is a reserved slug- Parameters:
settings (SettingsWrapper)
load_test_data (None)
- Return type:
None
Test Translation Utils
- tests.cms.utils.test_translation_utils.test_translate_link() None [source]
Test whether the
translate_link()
function correctly escapes message text while preserving the link tags- Return type:
None