general_fixtures#

Non specific fixtures for use across all tests.

This fixture is accessible to all tests due to its inclusion in conftest.py.

see: https://docs.pytest.org/en/6.2.x/fixture.html




Functions#

client

Return a TestClient with the startup event run, and where the shutdown event runs during teardown.

db_service

Get a SQL Connection to a fresh database with all Rootski tables ready.

make_app

Create an default instance of an app.

client()#

tests.fixtures.general_fixtures.client(disable_auth: bool, act_as_admin: bool, db_service: rootski.services.database.database.DBService) starlette.testclient.TestClient[source]#

Return a TestClient with the startup event run, and where the shutdown event runs during teardown.

This link explains how the “on_startup” event is triggered by this code: https://fastapi.tiangolo.com/advanced/testing-events/

Parameters
  • disable_auth – if True, mocks out most of auth so that there are no dependencies on AWS Cognito

  • act_as_admin – if True, the test user will be made an admin for the lifetime of the app created by this function

db_service()#

tests.fixtures.general_fixtures.db_service() rootski.services.database.database.DBService[source]#

Get a SQL Connection to a fresh database with all Rootski tables ready.

make_app()#

tests.fixtures.general_fixtures.make_app(disable_auth=True) fastapi.applications.FastAPI[source]#

Create an default instance of an app.

Parameters

enable_auth – if False, disable auth so that all requests are made by the global test user.