mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-20 08:55:24 -04:00
🔥 Remove Pydantic v1 specific test variants (#14611)
This commit is contained in:
1 parent
8322a4445a
commit
44c849c4fc
104 files changed
+4139
-8074
No files matched your search
@@ -1,5 +1,5 @@
|
||||
from dirty_equals import IsOneOf
|
||||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
from docs_src.behind_a_proxy.tutorial003_py39 import app
|
||||
|
||||
@@ -15,40 +15,34 @@ def test_main():
|
||||
def test_openapi_schema():
|
||||
response = client.get("/openapi.json")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"servers": [
|
||||
{"url": "/api/v1"},
|
||||
{
|
||||
"url": IsOneOf(
|
||||
"https://stag.example.com/",
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
"https://stag.example.com",
|
||||
),
|
||||
"description": "Staging environment",
|
||||
},
|
||||
{
|
||||
"url": IsOneOf(
|
||||
"https://prod.example.com/",
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
"https://prod.example.com",
|
||||
),
|
||||
"description": "Production environment",
|
||||
},
|
||||
],
|
||||
"paths": {
|
||||
"/app": {
|
||||
"get": {
|
||||
"summary": "Read Main",
|
||||
"operationId": "read_main_app_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {"application/json": {"schema": {}}},
|
||||
}
|
||||
},
|
||||
assert response.json() == snapshot(
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"servers": [
|
||||
{"url": "/api/v1"},
|
||||
{
|
||||
"url": "https://stag.example.com",
|
||||
"description": "Staging environment",
|
||||
},
|
||||
{
|
||||
"url": "https://prod.example.com",
|
||||
"description": "Production environment",
|
||||
},
|
||||
],
|
||||
"paths": {
|
||||
"/app": {
|
||||
"get": {
|
||||
"summary": "Read Main",
|
||||
"operationId": "read_main_app_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {"application/json": {"schema": {}}},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
from dirty_equals import IsOneOf
|
||||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
from docs_src.behind_a_proxy.tutorial004_py39 import app
|
||||
|
||||
@@ -15,39 +15,33 @@ def test_main():
|
||||
def test_openapi_schema():
|
||||
response = client.get("/openapi.json")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"servers": [
|
||||
{
|
||||
"url": IsOneOf(
|
||||
"https://stag.example.com/",
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
"https://stag.example.com",
|
||||
),
|
||||
"description": "Staging environment",
|
||||
},
|
||||
{
|
||||
"url": IsOneOf(
|
||||
"https://prod.example.com/",
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
"https://prod.example.com",
|
||||
),
|
||||
"description": "Production environment",
|
||||
},
|
||||
],
|
||||
"paths": {
|
||||
"/app": {
|
||||
"get": {
|
||||
"summary": "Read Main",
|
||||
"operationId": "read_main_app_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {"application/json": {"schema": {}}},
|
||||
}
|
||||
},
|
||||
assert response.json() == snapshot(
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://stag.example.com",
|
||||
"description": "Staging environment",
|
||||
},
|
||||
{
|
||||
"url": "https://prod.example.com",
|
||||
"description": "Production environment",
|
||||
},
|
||||
],
|
||||
"paths": {
|
||||
"/app": {
|
||||
"get": {
|
||||
"summary": "Read Main",
|
||||
"operationId": "read_main_app_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {"application/json": {"schema": {}}},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
Reference in new issue
Block a user