Home / File/ test_tutorial006.py — fastapi Source File

test_tutorial006.py — fastapi Source File

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

File python FastAPI Responses 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  ad2a5b5a_8989_7782_5e5b_7e4610a75cde["test_tutorial006.py"]
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  ad2a5b5a_8989_7782_5e5b_7e4610a75cde --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  ad2a5b5a_8989_7782_5e5b_7e4610a75cde --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  58fe161f_981d_d627_21e6_a41ffff5f7bc["tutorial006_py39.py"]
  ad2a5b5a_8989_7782_5e5b_7e4610a75cde --> 58fe161f_981d_d627_21e6_a41ffff5f7bc
  style ad2a5b5a_8989_7782_5e5b_7e4610a75cde fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from fastapi.testclient import TestClient
from inline_snapshot import snapshot

from docs_src.path_operation_advanced_configuration.tutorial006_py39 import app

client = TestClient(app)


def test_post():
    response = client.post("/items/", content=b"this is actually not validated")
    assert response.status_code == 200, response.text
    assert response.json() == {
        "size": 30,
        "content": {
            "name": "Maaaagic",
            "price": 42,
            "description": "Just kiddin', no magic here. ✨",
        },
    }


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == snapshot(
        {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/items/": {
                    "post": {
                        "summary": "Create Item",
                        "operationId": "create_item_items__post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "required": ["name", "price"],
                                        "type": "object",
                                        "properties": {
                                            "name": {"type": "string"},
                                            "price": {"type": "number"},
                                            "description": {"type": "string"},
                                        },
                                    }
                                }
                            },
                            "required": True,
                        },
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                    }
                }
            },
        }
    )

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_tutorial006.py do?
test_tutorial006.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_tutorial006.py?
test_tutorial006.py defines 2 function(s): test_openapi_schema, test_post.
What does test_tutorial006.py depend on?
test_tutorial006.py imports 3 module(s): inline_snapshot, testclient.py, tutorial006_py39.py.
Where is test_tutorial006.py in the architecture?
test_tutorial006.py is located at tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial006.py (domain: FastAPI, subdomain: Responses, directory: tests/test_tutorial/test_path_operation_advanced_configurations).

Analyze Your Own Codebase

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

Try Supermodel Free