test_callback_override_generate_unique_id() — fastapi Function Reference
Architecture documentation for the test_callback_override_generate_unique_id() function in test_generate_unique_id_function.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 91fd33e1_c0c1_95bb_17af_05ea3f6c797c["test_callback_override_generate_unique_id()"] 34109265_bcd4_7c26_355d_8af6a3269186["test_generate_unique_id_function.py"] 91fd33e1_c0c1_95bb_17af_05ea3f6c797c -->|defined in| 34109265_bcd4_7c26_355d_8af6a3269186 12dce19e_74a0_f6cd_7c8f_689f6d3bd491["post()"] 91fd33e1_c0c1_95bb_17af_05ea3f6c797c -->|calls| 12dce19e_74a0_f6cd_7c8f_689f6d3bd491 1b892f95_174f_a6fa_5ff9_9cd8b88e8ee0["get()"] 91fd33e1_c0c1_95bb_17af_05ea3f6c797c -->|calls| 1b892f95_174f_a6fa_5ff9_9cd8b88e8ee0 style 91fd33e1_c0c1_95bb_17af_05ea3f6c797c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_generate_unique_id_function.py lines 1377–1669
def test_callback_override_generate_unique_id():
app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
callback_router = APIRouter(generate_unique_id_function=custom_generate_unique_id2)
@callback_router.post(
"/post-callback",
response_model=list[Item],
responses={404: {"model": list[Message]}},
generate_unique_id_function=custom_generate_unique_id3,
)
def post_callback(item1: Item, item2: Item):
return item1, item2 # pragma: nocover
@app.post(
"/",
response_model=list[Item],
responses={404: {"model": list[Message]}},
generate_unique_id_function=custom_generate_unique_id3,
callbacks=callback_router.routes,
)
def post_root(item1: Item, item2: Item):
return item1, item2 # pragma: nocover
@app.post(
"/tocallback",
response_model=list[Item],
responses={404: {"model": list[Message]}},
)
def post_with_callback(item1: Item, item2: Item):
return item1, item2 # pragma: nocover
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": "baz_post_root",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_baz_post_root"
}
}
},
"required": True,
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"title": "Response Baz Post Root",
"type": "array",
"items": {
"$ref": "#/components/schemas/Item"
},
}
}
},
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"title": "Response 404 Baz Post Root",
"type": "array",
"items": {
"$ref": "#/components/schemas/Message"
},
}
}
},
},
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_callback_override_generate_unique_id() do?
test_callback_override_generate_unique_id() is a function in the fastapi codebase, defined in tests/test_generate_unique_id_function.py.
Where is test_callback_override_generate_unique_id() defined?
test_callback_override_generate_unique_id() is defined in tests/test_generate_unique_id_function.py at line 1377.
What does test_callback_override_generate_unique_id() call?
test_callback_override_generate_unique_id() calls 2 function(s): get, post.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free