Home / Function/ test_post_files_and_token() — fastapi Function Reference

test_post_files_and_token() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py lines 129–147

def test_post_files_and_token(tmp_path, app: FastAPI):
    patha = tmp_path / "test.txt"
    pathb = tmp_path / "testb.txt"
    patha.write_text("<file content>")
    pathb.write_text("<file b content>")

    client = TestClient(app)
    with patha.open("rb") as filea, pathb.open("rb") as fileb:
        response = client.post(
            "/files/",
            data={"token": "foo"},
            files={"file": filea, "fileb": ("testb.txt", fileb, "text/plain")},
        )
    assert response.status_code == 200, response.text
    assert response.json() == {
        "file_size": 14,
        "token": "foo",
        "fileb_content_type": "text/plain",
    }

Domain

Subdomains

Frequently Asked Questions

What does test_post_files_and_token() do?
test_post_files_and_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_files_and_token() defined?
test_post_files_and_token() is defined in tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py at line 129.

Analyze Your Own Codebase

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

Try Supermodel Free