- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for test_get_user (0.06 sec)
-
tests/test_infer_param_optionality.py
app.include_router(item_router, prefix="/users/{user_id}/items") client = TestClient(app) def test_get_users(): """Check that /users returns expected data""" response = client.get("/users") assert response.status_code == 200, response.text assert response.json() == [{"user_id": "u1"}, {"user_id": "u2"}] def test_get_user(): """Check that /users/{user_id} returns expected data"""
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 12.1K bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial003b.py
import asyncio from fastapi.testclient import TestClient from docs_src.path_params.tutorial003b_py39 import app, read_users2 client = TestClient(app) def test_get_users(): response = client.get("/users") assert response.status_code == 200, response.text assert response.json() == ["Rick", "Morty"] def test_read_users2(): # Just for coverage assert asyncio.run(read_users2()) == ["Bean", "Elfo"]
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.3K bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial003.py
client = TestClient(app) @pytest.mark.parametrize( ("user_id", "expected_response"), [ ("me", {"user_id": "the current user"}), ("alice", {"user_id": "alice"}), ], ) def test_get_users(user_id: str, expected_response: dict): response = client.get(f"/users/{user_id}") assert response.status_code == 200, response.text assert response.json() == expected_response def test_openapi_schema():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 4.6K bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_configurations/test_tutorial002.py
} def test_get_items(client: TestClient): response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == [{"name": "Foo", "price": 42}] def test_get_users(client: TestClient): response = client.get("/users/") assert response.status_code == 200, response.text assert response.json() == [{"username": "johndoe"}] def test_openapi_schema(client: TestClient):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 7.6K bytes - Viewed (0)