tests package#
Subpackages#
- tests.integration package
- tests.management package
- Subpackages
- tests.management.commands package
- Submodules
- tests.management.commands.add_additional_test_data_for_clubs module
- tests.management.commands.add_test_data module
- tests.management.commands.add_test_data_forum_posts module
- tests.management.commands.create_test_users_from_session_file module
- tests.management.commands.mass_email_test module
- tests.management.commands.reformat_test_csvs module
- tests.management.commands.run_tests_integration module
- tests.management.commands.run_tests_silent module
- tests.management.commands.run_tests_unit module
- tests.management.commands.sanitise_production_data_for_testing module
- Module contents
- tests.management.commands package
- Module contents
- Subpackages
- tests.unit package
Submodules#
tests.apps module#
tests.test_manager module#
- class tests.test_manager.CobaltTestManagerAbstract(app=None)[source]#
Bases:
ABC
Abstract class to hold things that are common across the two types of testing: Unit testing (single, short tests) and Integration testing (larger, connected stories).
- save_results(status, test_name, test_description=None, output=None)[source]#
handle logging results
- Parameters:
status – Boolean for success or failure OR HTTP Status Code
test_name – Str. Name of test (short description)
test_description – Str. Explains what this test does in detail (optional)
output – Output from test
- class tests.test_manager.CobaltTestManagerIntegration(app, browser, base_url, headless, single_test)[source]#
Bases:
CobaltTestManagerAbstract
This orchestrates the automated integration tests.
It assumes a fresh database is in place.
Three types of test can be performed:
- Internal - using views and models to update and view the data, checking
for core functionality
- Client - using Django’s test client we can access the “screens” through
an API, interacting with the system through POST and GET. This tests the external interfaces but runs no client side code.
- Selenium - Selenium handles the UI tests. These tests interact with
the UI in the same way as a user would and test both the server and client code, although ugly screens and typos will not be detected. This can also test different browsers.
This class provides basic set up for the tests that are run and collates the results.
To add tests you can copy an existing one. Tests can use any combination of the approaches mentioned above.
- selenium_wait_for_clickable(element_id, timeout=5)[source]#
Wait for element_id to be clickable and return it. E.g. if element is hidden.
- selenium_wait_for_clickable_by_name(element_name, timeout=5)[source]#
Wait for element_name to be clickable and return it.
- class tests.test_manager.CobaltTestManagerUnit(app=None)[source]#
Bases:
CobaltTestManagerAbstract
Class to handle unit tests
tests.urls module#
tests.views module#
We needed to do some testing on the htmx search and it seemed useful to add a test url for it