Home / File/ test_tutorial001.py — fastapi Source File

test_tutorial001.py — fastapi Source File

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

File python FastAPI Routing 5 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  68fab5bf_d288_818d_ce80_472dd26a29a4["test_tutorial001.py"]
  9c2c9cad_dfd2_7d1a_1c6d_b8a448285db4["warnings"]
  68fab5bf_d288_818d_ce80_472dd26a29a4 --> 9c2c9cad_dfd2_7d1a_1c6d_b8a448285db4
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  68fab5bf_d288_818d_ce80_472dd26a29a4 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  68fab5bf_d288_818d_ce80_472dd26a29a4 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  bcc067f0_0107_d76b_204a_6705d20b4cf9["starlette.testclient"]
  68fab5bf_d288_818d_ce80_472dd26a29a4 --> bcc067f0_0107_d76b_204a_6705d20b4cf9
  8946861d_c6ff_4007_e36b_5e98f0d2e40c["tutorial001_py39.py"]
  68fab5bf_d288_818d_ce80_472dd26a29a4 --> 8946861d_c6ff_4007_e36b_5e98f0d2e40c
  style 68fab5bf_d288_818d_ce80_472dd26a29a4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import warnings

import pytest
from inline_snapshot import snapshot
from starlette.testclient import TestClient

warnings.filterwarnings(
    "ignore",
    message=r"The 'lia' package has been renamed to 'cross_web'\..*",
    category=DeprecationWarning,
)

from docs_src.graphql_.tutorial001_py39 import app  # noqa: E402


@pytest.fixture(name="client")
def get_client() -> TestClient:
    return TestClient(app)


def test_query(client: TestClient):
    response = client.post("/graphql", json={"query": "{ user { name, age } }"})
    assert response.status_code == 200
    assert response.json() == {"data": {"user": {"name": "Patrick", "age": 100}}}


def test_openapi(client: TestClient):
    response = client.get("/openapi.json")
    assert response.status_code == 200
    assert response.json() == snapshot(
        {
            "info": {
                "title": "FastAPI",
                "version": "0.1.0",
            },
            "openapi": "3.1.0",
            "paths": {
                "/graphql": {
                    "get": {
                        "operationId": "handle_http_get_graphql_get",
                        "responses": {
                            "200": {
                                "content": {
                                    "application/json": {
                                        "schema": {},
                                    },
                                },
                                "description": "The GraphiQL integrated development environment.",
                            },
                            "404": {
                                "description": "Not found if GraphiQL or query via GET are not enabled.",
                            },
                        },
                        "summary": "Handle Http Get",
                    },
                    "post": {
                        "operationId": "handle_http_post_graphql_post",
                        "responses": {
                            "200": {
                                "content": {
                                    "application/json": {
                                        "schema": {},
                                    },
                                },
                                "description": "Successful Response",
                            },
                        },
                        "summary": "Handle Http Post",
                    },
                },
            },
        }
    )

Domain

Subdomains

Dependencies

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, Routing subdomain.
What functions are defined in test_tutorial001.py?
test_tutorial001.py defines 3 function(s): get_client, test_openapi, test_query.
What does test_tutorial001.py depend on?
test_tutorial001.py imports 5 module(s): inline_snapshot, pytest, starlette.testclient, tutorial001_py39.py, warnings.
Where is test_tutorial001.py in the architecture?
test_tutorial001.py is located at tests/test_tutorial/test_graphql/test_tutorial001.py (domain: FastAPI, subdomain: Routing, directory: tests/test_tutorial/test_graphql).

Analyze Your Own Codebase

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

Try Supermodel Free