Exemplo n.º 1
0
def custom_test_server():
    container = ServerContainer()
    container.wire(modules=[users])
    app = FastAPI()
    app.container = container
    app.include_router(users.router)
    yield app
Exemplo n.º 2
0
def custom_test_server():
    container = ServerContainer()
    container.wire(modules=[authenticate])
    app = FastAPI()
    app.container = container
    app.include_router(authenticate.router)
    yield app
Exemplo n.º 3
0
def custom_test_server():
    container = ServerContainer()
    container.wire(modules=[emissions])
    app = FastAPI()
    app.container = container
    app.include_router(emissions.router)
    add_pagination(app)
    yield app
Exemplo n.º 4
0
def init_container():
    container = ServerContainer()
    container.wire(modules=[
        emissions,
        runs,
        experiments,
        projects,
        teams,
        organizations,
        users,
        authenticate,
    ])
    return container
Exemplo n.º 5
0
def test_container_exposes_correct_list_of_providers_at_initialisation():
    expected_providers = [
        "config",
        "db",
        "emission_repository",
        "experiment_repository",
        "project_global_sum_by_experiment_usecase",
        "project_repository",
        "team_repository",
        "organization_repository",
        "user_repository",
        "emission_service",
        "experiment_service",
        "project_service",
        "team_service",
        "run_repository",
        "run_service",
        "organization_service",
        "user_service",
        "sign_up_service",
    ]

    actual_providers = ServerContainer().providers.keys()
    diff = set(expected_providers) ^ set(actual_providers)

    assert not diff
    assert len(expected_providers) == len(actual_providers)