mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-24 02:39:27 -04:00
✅ Add tests for metadata
This commit is contained in:
1 parent
4c51bb6714
commit
6b9931f882
8 files changed
+123
-3
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,34 @@
|
||||
from starlette.testclient import TestClient
|
||||
|
||||
from application_configuration.tutorial001 import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
openapi_schema = {
|
||||
"openapi": "3.0.2",
|
||||
"info": {
|
||||
"title": "My Super Project",
|
||||
"version": "2.5.0",
|
||||
"description": "This is a very fancy project, with auto docs for the API and everything",
|
||||
},
|
||||
"paths": {
|
||||
"/items/": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {"application/json": {"schema": {}}},
|
||||
}
|
||||
},
|
||||
"summary": "Read Items Get",
|
||||
"operationId": "read_items_items__get",
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_openapi_scheme():
|
||||
response = client.get("/openapi.json")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == openapi_schema
|
||||
Reference in new issue
Block a user