Reference .testing¶
cattle_grid.extensions.testing ¶
actor_with_account
async
¶
actor_with_account(sql_session, account_for_test) -> Actor
Fixture to create an actor with an account
Source code in cattle_grid/testing/fixtures.py
loaded_config ¶
Ensures the configuration variables are loaded
sql_engine_for_tests
async
¶
Provides the sql engine (as in memory sqlite) for tests
This fixture has autouse=True, meaning that by importing
it will run automatically. The engine is initialized in the place cattle_grid expects it.
Source code in cattle_grid/testing/fixtures.py
sql_session
async
¶
Returns an AsyncSession to be used by tests
with_test_broker_for_extension
async
¶
Creates a test broker with subscribtions to the routing_keys given in subscriber.
my_mock = AsyncMock()
async with with_test_broker_for_extension([extension], {
"routing_key_to_listen_to": my_mock
})