Home / Function/ test_token_nonexistent_user() — fastapi Function Reference

test_token_nonexistent_user() — fastapi Function Reference

Architecture documentation for the test_token_nonexistent_user() function in test_tutorial005.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  b6f2e3a4_89b6_e5ca_61af_34476d0a30e2["test_token_nonexistent_user()"]
  132df24a_932a_c5a5_9fcb_bb38e95d696f["test_tutorial005.py"]
  b6f2e3a4_89b6_e5ca_61af_34476d0a30e2 -->|defined in| 132df24a_932a_c5a5_9fcb_bb38e95d696f
  style b6f2e3a4_89b6_e5ca_61af_34476d0a30e2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_security/test_tutorial005.py lines 159–170

def test_token_nonexistent_user(mod: ModuleType):
    client = TestClient(mod.app)

    response = client.get(
        "/users/me",
        headers={
            "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VybmFtZTpib2IifQ.HcfCW67Uda-0gz54ZWTqmtgJnZeNem0Q757eTa9EZuw"
        },
    )
    assert response.status_code == 401, response.text
    assert response.json() == {"detail": "Could not validate credentials"}
    assert response.headers["WWW-Authenticate"] == 'Bearer scope="me"'

Domain

Subdomains

Frequently Asked Questions

What does test_token_nonexistent_user() do?
test_token_nonexistent_user() is a function in the fastapi codebase, defined in tests/test_tutorial/test_security/test_tutorial005.py.
Where is test_token_nonexistent_user() defined?
test_token_nonexistent_user() is defined in tests/test_tutorial/test_security/test_tutorial005.py at line 159.

Analyze Your Own Codebase

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

Try Supermodel Free