- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 23 for expected_response (0.06 sec)
-
tests/test_param_include_in_schema.py
), ], ) 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 @pytest.mark.parametrize( "path,headers,expected_status,expected_response", [ ( "/hidden_header", {},Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Mar 26 16:56:53 UTC 2024 - 7.4K bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial003.py
@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_dependencies/test_tutorial005.py
), ], ) def test_get(path, cookie, expected_status, expected_response, client: TestClient): if cookie is not None: client.cookies.set("last_query", cookie) else: client.cookies.clear() response = client.get(path) assert response.status_code == expected_status assert response.json() == expected_response 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 - 4.5K bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_configurations/test_tutorial006.py
client = TestClient(app) @pytest.mark.parametrize( "path,expected_status,expected_response", [ ("/items/", 200, [{"name": "Foo", "price": 42}]), ("/users/", 200, [{"username": "johndoe"}]), ("/elements/", 200, [{"item_id": "Foo"}]), ], ) def test_query_params_str_validations(path, expected_status, expected_response): response = client.get(path) assert response.status_code == expected_status
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 2.4K bytes - Viewed (0) -
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial005.py
@pytest.mark.parametrize( "path,expected_response", [ ("/items/1?q=", {"item_id": 1}), ("/items/1000?q=somequery", {"item_id": 1000, "q": "somequery"}), ], ) def test_read_items(client: TestClient, path, expected_response): response = client.get(path) assert response.status_code == 200, response.text assert response.json() == expected_response
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 6.6K bytes - Viewed (0) -
tests/test_tutorial/test_first_steps/test_tutorial001_tutorial002_tutorial003.py
@pytest.mark.parametrize( "path,expected_status,expected_response", [ ("/", 200, {"message": "Hello World"}), ("/nonexistent", 404, {"detail": "Not Found"}), ], ) def test_get_path(client: TestClient, path, expected_status, expected_response): response = client.get(path) assert response.status_code == expected_status assert response.json() == expected_response
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.4K bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial001.py
client = TestClient(app) @pytest.mark.parametrize( ("item_id", "expected_response"), [ (1, {"item_id": "1"}), ("alice", {"item_id": "alice"}), ], ) def test_get_items(item_id, expected_response): response = client.get(f"/items/{item_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 - 3.9K bytes - Viewed (0) -
tests/test_tutorial/test_cookie_params/test_tutorial001.py
], ) def test(path, cookies, expected_status, expected_response, mod: ModuleType): client = TestClient(mod.app, cookies=cookies) response = client.get(path) assert response.status_code == expected_status assert response.json() == expected_response def test_openapi_schema(mod: ModuleType): client = TestClient(mod.app)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 4K bytes - Viewed (0) -
tests/test_tutorial/test_header_params/test_tutorial001.py
@pytest.mark.parametrize( "path,headers,expected_status,expected_response", [ ("/items", None, 200, {"User-Agent": "testclient"}), ("/items", {"X-Header": "notvalid"}, 200, {"User-Agent": "testclient"}), ("/items", {"User-Agent": "FastAPI test"}, 200, {"User-Agent": "FastAPI test"}), ], ) def test(path, headers, expected_status, expected_response, client: TestClient):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 3.9K bytes - Viewed (0) -
tests/test_tutorial/test_header_params/test_tutorial002.py
200, {"strange_header": None}, ), ], ) def test(path, headers, expected_status, expected_response, client: TestClient): response = client.get(path, headers=headers) assert response.status_code == expected_status assert response.json() == expected_response def test_openapi_schema(client: TestClient): response = client.get("/openapi.json") assert response.status_code == 200Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 4.1K bytes - Viewed (0)