Browse Source

increase test coverage

pull/97/head
Mohammed 6 years ago
parent
commit
25fb4239cc
  1. 14
      tests/test_additional_responses.py

14
tests/test_additional_responses.py

@ -1,3 +1,4 @@
import pytest
from fastapi import FastAPI
from fastapi.openapi.models import AdditionalResponse
from pydantic import BaseModel
@ -409,6 +410,19 @@ openapi_schema = {
}
def test_uncompatible_response_model_undecorated():
app = FastAPI()
class NotBaseModel:
pass
response_403 = AdditionalResponse(
status_code=403, description="Forbidden", models=[NotBaseModel]
)
with pytest.raises(ValueError):
app.add_api_route("/", get_not_decorated, additional_responses=[response_403])
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200

Loading…
Cancel
Save