Home / File/ test_no_swagger_ui_redirect.py — fastapi Source File

test_no_swagger_ui_redirect.py — fastapi Source File

Architecture documentation for test_no_swagger_ui_redirect.py, a python file in the fastapi codebase. 2 imports, 0 dependents.

File python FastAPI Responses 2 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  8c69dd62_7e96_47cc_b631_577e4ecbb73d["test_no_swagger_ui_redirect.py"]
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  8c69dd62_7e96_47cc_b631_577e4ecbb73d --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  8c69dd62_7e96_47cc_b631_577e4ecbb73d --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style 8c69dd62_7e96_47cc_b631_577e4ecbb73d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from fastapi import FastAPI
from fastapi.testclient import TestClient

app = FastAPI(swagger_ui_oauth2_redirect_url=None)


@app.get("/items/")
async def read_items():
    return {"id": "foo"}


client = TestClient(app)


def test_swagger_ui():
    response = client.get("/docs")
    assert response.status_code == 200, response.text
    assert response.headers["content-type"] == "text/html; charset=utf-8"
    assert "swagger-ui-dist" in response.text
    print(client.base_url)
    assert "oauth2RedirectUrl" not in response.text


def test_swagger_ui_no_oauth2_redirect():
    response = client.get("/docs/oauth2-redirect")
    assert response.status_code == 404, response.text


def test_response():
    response = client.get("/items/")
    assert response.json() == {"id": "foo"}

Domain

Subdomains

Frequently Asked Questions

What does test_no_swagger_ui_redirect.py do?
test_no_swagger_ui_redirect.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_no_swagger_ui_redirect.py?
test_no_swagger_ui_redirect.py defines 4 function(s): read_items, test_response, test_swagger_ui, test_swagger_ui_no_oauth2_redirect.
What does test_no_swagger_ui_redirect.py depend on?
test_no_swagger_ui_redirect.py imports 2 module(s): __init__.py, testclient.py.
Where is test_no_swagger_ui_redirect.py in the architecture?
test_no_swagger_ui_redirect.py is located at tests/test_no_swagger_ui_redirect.py (domain: FastAPI, subdomain: Responses, directory: tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free