Add failing test

This commit is contained in:
Sławek Ehlert 2024-05-02 15:07:00 +02:00
parent a94ef3351e
commit 5cdecf2e7c
1 changed files with 32 additions and 4 deletions

View File

@ -26,8 +26,8 @@ class Item(BaseModel):
def get_app_client(separate_input_output_schemas: bool = True) -> TestClient: def get_app_client(separate_input_output_schemas: bool = True) -> TestClient:
app = FastAPI(separate_input_output_schemas=separate_input_output_schemas) app = FastAPI(separate_input_output_schemas=separate_input_output_schemas)
@app.post("/items/") @app.post("/items/", responses={402: {"model": Item}})
def create_item(item: Item): def create_item(item: Item) -> Item:
return item return item
@app.post("/items-list/") @app.post("/items-list/")
@ -174,7 +174,23 @@ def test_openapi_schema():
"responses": { "responses": {
"200": { "200": {
"description": "Successful Response", "description": "Successful Response",
"content": {"application/json": {"schema": {}}}, "content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Item-Output"
}
}
},
},
"402": {
"description": "Payment Required",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Item-Output"
}
}
},
}, },
"422": { "422": {
"description": "Validation Error", "description": "Validation Error",
@ -374,7 +390,19 @@ def test_openapi_schema_no_separate():
"responses": { "responses": {
"200": { "200": {
"description": "Successful Response", "description": "Successful Response",
"content": {"application/json": {"schema": {}}}, "content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/Item"}
}
},
},
"402": {
"description": "Payment Required",
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/Item"}
}
},
}, },
"422": { "422": {
"description": "Validation Error", "description": "Validation Error",