Home / File/ test_param_include_in_schema.py — fastapi Source File

test_param_include_in_schema.py — fastapi Source File

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

File python FastAPI Routing 5 imports 9 functions

Entity Profile

Dependency Diagram

graph LR
  16af9b4a_d630_3cfd_79ed_44bfc929e2d1["test_param_include_in_schema.py"]
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  16af9b4a_d630_3cfd_79ed_44bfc929e2d1 --> 0dda2280_3359_8460_301c_e98c77e78185
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  16af9b4a_d630_3cfd_79ed_44bfc929e2d1 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  16af9b4a_d630_3cfd_79ed_44bfc929e2d1 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  16af9b4a_d630_3cfd_79ed_44bfc929e2d1 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  16af9b4a_d630_3cfd_79ed_44bfc929e2d1 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  style 16af9b4a_d630_3cfd_79ed_44bfc929e2d1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Optional

import pytest
from fastapi import Cookie, FastAPI, Header, Path, Query
from fastapi.testclient import TestClient
from inline_snapshot import snapshot

app = FastAPI()


@app.get("/hidden_cookie")
async def hidden_cookie(
    hidden_cookie: Optional[str] = Cookie(default=None, include_in_schema=False),
):
    return {"hidden_cookie": hidden_cookie}


@app.get("/hidden_header")
async def hidden_header(
    hidden_header: Optional[str] = Header(default=None, include_in_schema=False),
):
    return {"hidden_header": hidden_header}


@app.get("/hidden_path/{hidden_path}")
async def hidden_path(hidden_path: str = Path(include_in_schema=False)):
    return {"hidden_path": hidden_path}


@app.get("/hidden_query")
async def hidden_query(
    hidden_query: Optional[str] = Query(default=None, include_in_schema=False),
):
    return {"hidden_query": hidden_query}


@pytest.mark.parametrize(
    "path,cookies,expected_status,expected_response",
    [
        (
            "/hidden_cookie",
            {},
            200,
            {"hidden_cookie": None},
        ),
        (
            "/hidden_cookie",
            {"hidden_cookie": "somevalue"},
            200,
            {"hidden_cookie": "somevalue"},
        ),
    ],
)
def test_hidden_cookie(path, cookies, expected_status, expected_response):
    client = TestClient(app, cookies=cookies)
    response = client.get(path)
    assert response.status_code == expected_status
    assert response.json() == expected_response


// ... (189 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_param_include_in_schema.py do?
test_param_include_in_schema.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_param_include_in_schema.py?
test_param_include_in_schema.py defines 9 function(s): hidden_cookie, hidden_header, hidden_path, hidden_query, test_hidden_cookie, test_hidden_header, test_hidden_path, test_hidden_query, test_openapi_schema.
What does test_param_include_in_schema.py depend on?
test_param_include_in_schema.py imports 5 module(s): __init__.py, inline_snapshot, pytest, testclient.py, typing.
Where is test_param_include_in_schema.py in the architecture?
test_param_include_in_schema.py is located at tests/test_param_include_in_schema.py (domain: FastAPI, subdomain: Routing, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free