|
|
@ -1,6 +1,7 @@ |
|
|
from fastapi import FastAPI |
|
|
from fastapi import FastAPI |
|
|
from fastapi.responses import JSONResponse |
|
|
from fastapi.responses import JSONResponse |
|
|
from fastapi.testclient import TestClient |
|
|
from fastapi.testclient import TestClient |
|
|
|
|
|
from inline_snapshot import snapshot |
|
|
from pydantic import BaseModel |
|
|
from pydantic import BaseModel |
|
|
|
|
|
|
|
|
app = FastAPI() |
|
|
app = FastAPI() |
|
|
@ -39,7 +40,8 @@ client = TestClient(app) |
|
|
def test_openapi_schema(): |
|
|
def test_openapi_schema(): |
|
|
response = client.get("/openapi.json") |
|
|
response = client.get("/openapi.json") |
|
|
assert response.status_code == 200, response.text |
|
|
assert response.status_code == 200, response.text |
|
|
assert response.json() == { |
|
|
assert response.json() == snapshot( |
|
|
|
|
|
{ |
|
|
"openapi": "3.1.0", |
|
|
"openapi": "3.1.0", |
|
|
"info": {"title": "FastAPI", "version": "0.1.0"}, |
|
|
"info": {"title": "FastAPI", "version": "0.1.0"}, |
|
|
"paths": { |
|
|
"paths": { |
|
|
@ -112,3 +114,4 @@ def test_openapi_schema(): |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
) |
|
|
|