mirror of https://github.com/tiangolo/fastapi.git
Add failing test
This commit is contained in:
parent
a94ef3351e
commit
5cdecf2e7c
|
|
@ -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",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue