Home / File/ test_response_change_status_code.py — fastapi Source File

test_response_change_status_code.py — fastapi Source File

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

File python FastAPI Applications 2 imports 4 functions

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

from fastapi import Depends, FastAPI, Response
from fastapi.testclient import TestClient

app = FastAPI()


async def response_status_setter(response: Response):
    response.status_code = 201


async def parent_dep(result=Depends(response_status_setter)):
    return result


@app.get("/", dependencies=[Depends(parent_dep)])
async def get_main():
    return {"msg": "Hello World"}


client = TestClient(app)


def test_dependency_set_status_code():
    response = client.get("/")
    assert response.status_code == 201, response.text
    assert response.json() == {"msg": "Hello World"}

Domain

Subdomains

Frequently Asked Questions

What does test_response_change_status_code.py do?
test_response_change_status_code.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in test_response_change_status_code.py?
test_response_change_status_code.py defines 4 function(s): get_main, parent_dep, response_status_setter, test_dependency_set_status_code.
What does test_response_change_status_code.py depend on?
test_response_change_status_code.py imports 2 module(s): __init__.py, testclient.py.
Where is test_response_change_status_code.py in the architecture?
test_response_change_status_code.py is located at tests/test_response_change_status_code.py (domain: FastAPI, subdomain: Applications, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free