Sync fastapi docs from b5ca1324 on 2025-12-07
Issue Manager / issue-manager (push) Has been cancelled
Build Docs / changes (push) Has been cancelled
Build Docs / langs (push) Has been cancelled
Build Docs / build-docs (push) Has been cancelled
Build Docs / docs-all-green (push) Has been cancelled
Conflict detector / main (push) Has been cancelled
Test Redistribute / test-redistribute (fastapi) (push) Has been cancelled
Test Redistribute / test-redistribute (fastapi-slim) (push) Has been cancelled
Test Redistribute / test-redistribute-alls-green (push) Has been cancelled
Test / lint (push) Has been cancelled
Test / test (pydantic-v1, 3.10) (push) Has been cancelled
Test / test (pydantic-v1, 3.11) (push) Has been cancelled
Test / test (pydantic-v1, 3.13) (push) Has been cancelled
Test / test (pydantic-v1, 3.8) (push) Has been cancelled
Test / test (pydantic-v1, 3.9) (push) Has been cancelled
Test / test (pydantic-v2, 3.10) (push) Has been cancelled
Test / test (pydantic-v2, 3.11) (push) Has been cancelled
Test / test (pydantic-v2, 3.12) (push) Has been cancelled
Test / test (pydantic-v2, 3.13) (push) Has been cancelled
Test / test (pydantic-v2, 3.14) (push) Has been cancelled
Test / test (pydantic-v2, 3.8) (push) Has been cancelled
Test / test (pydantic-v2, 3.9) (push) Has been cancelled
Test / coverage-combine (push) Has been cancelled
Test / check (push) Has been cancelled
Label Approved / label-approved (push) Has been cancelled
FastAPI People Contributors / job (push) Has been cancelled
FastAPI People Sponsors / job (push) Has been cancelled
Update Topic Repos / topic-repos (push) Has been cancelled
FastAPI People / job (push) Has been cancelled
Test / test (pydantic-v1, 3.12) (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
Build Docs / changes (push) Has been cancelled
Build Docs / langs (push) Has been cancelled
Build Docs / build-docs (push) Has been cancelled
Build Docs / docs-all-green (push) Has been cancelled
Conflict detector / main (push) Has been cancelled
Test Redistribute / test-redistribute (fastapi) (push) Has been cancelled
Test Redistribute / test-redistribute (fastapi-slim) (push) Has been cancelled
Test Redistribute / test-redistribute-alls-green (push) Has been cancelled
Test / lint (push) Has been cancelled
Test / test (pydantic-v1, 3.10) (push) Has been cancelled
Test / test (pydantic-v1, 3.11) (push) Has been cancelled
Test / test (pydantic-v1, 3.13) (push) Has been cancelled
Test / test (pydantic-v1, 3.8) (push) Has been cancelled
Test / test (pydantic-v1, 3.9) (push) Has been cancelled
Test / test (pydantic-v2, 3.10) (push) Has been cancelled
Test / test (pydantic-v2, 3.11) (push) Has been cancelled
Test / test (pydantic-v2, 3.12) (push) Has been cancelled
Test / test (pydantic-v2, 3.13) (push) Has been cancelled
Test / test (pydantic-v2, 3.14) (push) Has been cancelled
Test / test (pydantic-v2, 3.8) (push) Has been cancelled
Test / test (pydantic-v2, 3.9) (push) Has been cancelled
Test / coverage-combine (push) Has been cancelled
Test / check (push) Has been cancelled
Label Approved / label-approved (push) Has been cancelled
FastAPI People Contributors / job (push) Has been cancelled
FastAPI People Sponsors / job (push) Has been cancelled
Update Topic Repos / topic-repos (push) Has been cancelled
FastAPI People / job (push) Has been cancelled
Test / test (pydantic-v1, 3.12) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from docs_src.configure_swagger_ui.tutorial001 import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_swagger_ui():
|
||||
response = client.get("/docs")
|
||||
assert response.status_code == 200, response.text
|
||||
assert '"syntaxHighlight": false' in response.text, (
|
||||
"syntaxHighlight should be included and converted to JSON"
|
||||
)
|
||||
assert '"dom_id": "#swagger-ui"' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "presets: [" in response.text, "default configs should be preserved"
|
||||
assert "SwaggerUIBundle.presets.apis," in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "SwaggerUIBundle.SwaggerUIStandalonePreset" in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"layout": "BaseLayout",' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"deepLinking": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"showExtensions": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"showCommonExtensions": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
|
||||
|
||||
def test_get_users():
|
||||
response = client.get("/users/foo")
|
||||
assert response.status_code == 200, response.text
|
||||
assert response.json() == {"message": "Hello foo"}
|
||||
@@ -0,0 +1,44 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from docs_src.configure_swagger_ui.tutorial002 import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_swagger_ui():
|
||||
response = client.get("/docs")
|
||||
assert response.status_code == 200, response.text
|
||||
assert '"syntaxHighlight": false' not in response.text, (
|
||||
"not used parameters should not be included"
|
||||
)
|
||||
assert '"syntaxHighlight": {"theme": "obsidian"}' in response.text, (
|
||||
"parameters with middle dots should be included in a JSON compatible way"
|
||||
)
|
||||
assert '"dom_id": "#swagger-ui"' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "presets: [" in response.text, "default configs should be preserved"
|
||||
assert "SwaggerUIBundle.presets.apis," in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "SwaggerUIBundle.SwaggerUIStandalonePreset" in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"layout": "BaseLayout",' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"deepLinking": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"showExtensions": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"showCommonExtensions": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
|
||||
|
||||
def test_get_users():
|
||||
response = client.get("/users/foo")
|
||||
assert response.status_code == 200, response.text
|
||||
assert response.json() == {"message": "Hello foo"}
|
||||
@@ -0,0 +1,44 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from docs_src.configure_swagger_ui.tutorial003 import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_swagger_ui():
|
||||
response = client.get("/docs")
|
||||
assert response.status_code == 200, response.text
|
||||
assert '"deepLinking": false,' in response.text, (
|
||||
"overridden configs should be preserved"
|
||||
)
|
||||
assert '"deepLinking": true' not in response.text, (
|
||||
"overridden configs should not include the old value"
|
||||
)
|
||||
assert '"syntaxHighlight": false' not in response.text, (
|
||||
"not used parameters should not be included"
|
||||
)
|
||||
assert '"dom_id": "#swagger-ui"' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "presets: [" in response.text, "default configs should be preserved"
|
||||
assert "SwaggerUIBundle.presets.apis," in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "SwaggerUIBundle.SwaggerUIStandalonePreset" in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"layout": "BaseLayout",' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"showExtensions": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"showCommonExtensions": true,' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
|
||||
|
||||
def test_get_users():
|
||||
response = client.get("/users/foo")
|
||||
assert response.status_code == 200, response.text
|
||||
assert response.json() == {"message": "Hello foo"}
|
||||
Reference in New Issue
Block a user