test_reponse_set_reponse_code_empty.py — fastapi Source File
Architecture documentation for test_reponse_set_reponse_code_empty.py, a python file in the fastapi codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR bfcad622_3c0f_6dca_8ab5_75c98eaa5f13["test_reponse_set_reponse_code_empty.py"] 0dda2280_3359_8460_301c_e98c77e78185["typing"] bfcad622_3c0f_6dca_8ab5_75c98eaa5f13 --> 0dda2280_3359_8460_301c_e98c77e78185 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] bfcad622_3c0f_6dca_8ab5_75c98eaa5f13 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] bfcad622_3c0f_6dca_8ab5_75c98eaa5f13 --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] bfcad622_3c0f_6dca_8ab5_75c98eaa5f13 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a style bfcad622_3c0f_6dca_8ab5_75c98eaa5f13 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from typing import Any
from fastapi import FastAPI, Response
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
app = FastAPI()
@app.delete(
"/{id}",
status_code=204,
response_model=None,
)
async def delete_deployment(
id: int,
response: Response,
) -> Any:
response.status_code = 400
return {"msg": "Status overwritten", "id": id}
client = TestClient(app)
def test_dependency_set_status_code():
response = client.delete("/1")
assert response.status_code == 400 and response.content
assert response.json() == {"msg": "Status overwritten", "id": 1}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == snapshot(
{
"openapi": "3.1.0",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/{id}": {
"delete": {
"summary": "Delete Deployment",
"operationId": "delete_deployment__id__delete",
"parameters": [
{
"required": True,
"schema": {"title": "Id", "type": "integer"},
"name": "id",
"in": "path",
}
],
"responses": {
"204": {"description": "Successful Response"},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
}
}
},
"components": {
"schemas": {
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
},
}
},
},
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [{"type": "string"}, {"type": "integer"}]
},
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
"input": {"title": "Input"},
"ctx": {"title": "Context", "type": "object"},
},
},
}
},
}
)
Domain
Subdomains
Dependencies
- __init__.py
- inline_snapshot
- testclient.py
- typing
Source
Frequently Asked Questions
What does test_reponse_set_reponse_code_empty.py do?
test_reponse_set_reponse_code_empty.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in test_reponse_set_reponse_code_empty.py?
test_reponse_set_reponse_code_empty.py defines 3 function(s): delete_deployment, test_dependency_set_status_code, test_openapi_schema.
What does test_reponse_set_reponse_code_empty.py depend on?
test_reponse_set_reponse_code_empty.py imports 4 module(s): __init__.py, inline_snapshot, testclient.py, typing.
Where is test_reponse_set_reponse_code_empty.py in the architecture?
test_reponse_set_reponse_code_empty.py is located at tests/test_reponse_set_reponse_code_empty.py (domain: FastAPI, subdomain: Applications, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free