Home / Function/ app_fixture() — fastapi Function Reference

app_fixture() — fastapi Function Reference

Architecture documentation for the app_fixture() function in test_security_scopes.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  647c4202_e61b_d8cf_5cdc_8928339ca8e4["app_fixture()"]
  e680b709_13b2_f6c0_e6f6_b4f590bae26a["test_security_scopes.py"]
  647c4202_e61b_d8cf_5cdc_8928339ca8e4 -->|defined in| e680b709_13b2_f6c0_e6f6_b4f590bae26a
  style 647c4202_e61b_d8cf_5cdc_8928339ca8e4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_security_scopes.py lines 14–31

def app_fixture(call_counter: dict[str, int]):
    def get_db():
        call_counter["count"] += 1
        return f"db_{call_counter['count']}"

    def get_user(db: Annotated[str, Depends(get_db)]):
        return "user"

    app = FastAPI()

    @app.get("/")
    def endpoint(
        db: Annotated[str, Depends(get_db)],
        user: Annotated[str, Security(get_user, scopes=["read"])],
    ):
        return {"db": db}

    return app

Domain

Subdomains

Frequently Asked Questions

What does app_fixture() do?
app_fixture() is a function in the fastapi codebase, defined in tests/test_security_scopes.py.
Where is app_fixture() defined?
app_fixture() is defined in tests/test_security_scopes.py at line 14.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free