test_top_level_generate_unique_id() — fastapi Function Reference
Architecture documentation for the test_top_level_generate_unique_id() function in test_generate_unique_id_function.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 151590c8_e931_55e7_3262_5eca3d623171["test_top_level_generate_unique_id()"] 34109265_bcd4_7c26_355d_8af6a3269186["test_generate_unique_id_function.py"] 151590c8_e931_55e7_3262_5eca3d623171 -->|defined in| 34109265_bcd4_7c26_355d_8af6a3269186 12dce19e_74a0_f6cd_7c8f_689f6d3bd491["post()"] 151590c8_e931_55e7_3262_5eca3d623171 -->|calls| 12dce19e_74a0_f6cd_7c8f_689f6d3bd491 c1d02f65_9a84_123a_bdd4_304e5732f35a["include_router()"] 151590c8_e931_55e7_3262_5eca3d623171 -->|calls| c1d02f65_9a84_123a_bdd4_304e5732f35a 1b892f95_174f_a6fa_5ff9_9cd8b88e8ee0["get()"] 151590c8_e931_55e7_3262_5eca3d623171 -->|calls| 1b892f95_174f_a6fa_5ff9_9cd8b88e8ee0 style 151590c8_e931_55e7_3262_5eca3d623171 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_generate_unique_id_function.py lines 32–239
def test_top_level_generate_unique_id():
app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
router = APIRouter()
@app.post("/", response_model=list[Item], responses={404: {"model": list[Message]}})
def post_root(item1: Item, item2: Item):
return item1, item2 # pragma: nocover
@router.post(
"/router", response_model=list[Item], responses={404: {"model": list[Message]}}
)
def post_router(item1: Item, item2: Item):
return item1, item2 # pragma: nocover
app.include_router(router)
client = TestClient(app)
response = client.get("/openapi.json")
assert response.json() == snapshot(
{
"openapi": "3.1.0",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/": {
"post": {
"summary": "Post Root",
"operationId": "foo_post_root",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_foo_post_root"
}
}
},
"required": True,
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"title": "Response Foo Post Root",
"type": "array",
"items": {
"$ref": "#/components/schemas/Item"
},
}
}
},
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"title": "Response 404 Foo Post Root",
"type": "array",
"items": {
"$ref": "#/components/schemas/Message"
},
}
}
},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
}
},
"/router": {
"post": {
"summary": "Post Router",
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_top_level_generate_unique_id() do?
test_top_level_generate_unique_id() is a function in the fastapi codebase, defined in tests/test_generate_unique_id_function.py.
Where is test_top_level_generate_unique_id() defined?
test_top_level_generate_unique_id() is defined in tests/test_generate_unique_id_function.py at line 32.
What does test_top_level_generate_unique_id() call?
test_top_level_generate_unique_id() calls 3 function(s): get, include_router, post.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free