Home / Function/ test_post_file_no_token() — fastapi Function Reference

test_post_file_no_token() — fastapi Function Reference

Architecture documentation for the test_post_file_no_token() function in test_tutorial001.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  e9bf8188_783f_eab2_05e3_0f21ddcf3f83["test_post_file_no_token()"]
  614f60df_8d14_f7af_179b_bab91ab02642["test_tutorial001.py"]
  e9bf8188_783f_eab2_05e3_0f21ddcf3f83 -->|defined in| 614f60df_8d14_f7af_179b_bab91ab02642
  style e9bf8188_783f_eab2_05e3_0f21ddcf3f83 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py lines 103–126

def test_post_file_no_token(tmp_path, app: FastAPI):
    path = tmp_path / "test.txt"
    path.write_bytes(b"<file content>")

    client = TestClient(app)
    with path.open("rb") as file:
        response = client.post("/files/", files={"file": file})
    assert response.status_code == 422, response.text
    assert response.json() == {
        "detail": [
            {
                "type": "missing",
                "loc": ["body", "fileb"],
                "msg": "Field required",
                "input": None,
            },
            {
                "type": "missing",
                "loc": ["body", "token"],
                "msg": "Field required",
                "input": None,
            },
        ]
    }

Domain

Subdomains

Frequently Asked Questions

What does test_post_file_no_token() do?
test_post_file_no_token() is a function in the fastapi codebase, defined in tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py.
Where is test_post_file_no_token() defined?
test_post_file_no_token() is defined in tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py at line 103.

Analyze Your Own Codebase

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

Try Supermodel Free