test_tutorial001.py — fastapi Source File
Architecture documentation for test_tutorial001.py, a python file in the fastapi codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9f9bd4b0_1cad_90ba_a82e_141dce5c9f58["test_tutorial001.py"] af9b440f_13c4_d91e_f8ae_bfe199b060d2["os"] 9f9bd4b0_1cad_90ba_a82e_141dce5c9f58 --> af9b440f_13c4_d91e_f8ae_bfe199b060d2 b3e303a2_3f2d_638d_930c_3a5dcc2f5a42["pathlib"] 9f9bd4b0_1cad_90ba_a82e_141dce5c9f58 --> b3e303a2_3f2d_638d_930c_3a5dcc2f5a42 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 9f9bd4b0_1cad_90ba_a82e_141dce5c9f58 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 9f9bd4b0_1cad_90ba_a82e_141dce5c9f58 --> a7c04dee_ee23_5891_b185_47ff6bed036d 21963e59_2145_4b3f_7959_1cb20fa40113["tutorial001_py39.py"] 9f9bd4b0_1cad_90ba_a82e_141dce5c9f58 --> 21963e59_2145_4b3f_7959_1cb20fa40113 style 9f9bd4b0_1cad_90ba_a82e_141dce5c9f58 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import os
from pathlib import Path
import pytest
from fastapi.testclient import TestClient
@pytest.fixture(scope="module")
def client():
static_dir: Path = Path(os.getcwd()) / "static"
print(static_dir)
static_dir.mkdir(exist_ok=True)
from docs_src.custom_docs_ui.tutorial001_py39 import app
with TestClient(app) as client:
yield client
static_dir.rmdir()
def test_swagger_ui_html(client: TestClient):
response = client.get("/docs")
assert response.status_code == 200, response.text
assert "https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js" in response.text
assert "https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" in response.text
def test_swagger_ui_oauth2_redirect_html(client: TestClient):
response = client.get("/docs/oauth2-redirect")
assert response.status_code == 200, response.text
assert "window.opener.swaggerUIRedirectOauth2" in response.text
def test_redoc_html(client: TestClient):
response = client.get("/redoc")
assert response.status_code == 200, response.text
assert "https://unpkg.com/redoc@2/bundles/redoc.standalone.js" in response.text
def test_api(client: TestClient):
response = client.get("/users/john")
assert response.status_code == 200, response.text
assert response.json()["message"] == "Hello john"
Domain
Subdomains
Functions
Dependencies
- os
- pathlib
- pytest
- testclient.py
- tutorial001_py39.py
Source
Frequently Asked Questions
What does test_tutorial001.py do?
test_tutorial001.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Responses subdomain.
What functions are defined in test_tutorial001.py?
test_tutorial001.py defines 5 function(s): client, test_api, test_redoc_html, test_swagger_ui_html, test_swagger_ui_oauth2_redirect_html.
What does test_tutorial001.py depend on?
test_tutorial001.py imports 5 module(s): os, pathlib, pytest, testclient.py, tutorial001_py39.py.
Where is test_tutorial001.py in the architecture?
test_tutorial001.py is located at tests/test_tutorial/test_custom_docs_ui/test_tutorial001.py (domain: FastAPI, subdomain: Responses, directory: tests/test_tutorial/test_custom_docs_ui).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free