Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for expected_response (0.05 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. tests/test_custom_route_class.py

    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/a", 200, {"msg": "A"}),
            ("/a/b", 200, {"msg": "B"}),
            ("/a/b/c", 200, {"msg": "C"}),
        ],
    )
    def test_get_path(path, expected_status, expected_response):
        response = client.get(path)
        assert response.status_code == expected_status
        assert response.json() == expected_response
    
    
    def test_route_classes():
        routes = {}
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top