Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 509 for testclient (0.04 sec)

  1. tests/test_tutorial/test_extra_models/test_tutorial005.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial005_py39"),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.extra_models.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_get_items(client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_body/test_tutorial002.py

    import importlib
    from typing import Union
    
    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial002_py39"),
            pytest.param("tutorial002_py310", marks=needs_py310),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.body.{request.param}")
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 5.3K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_body_nested_models/test_tutorial008.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial008_py39"),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.body_nested_models.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_post_body(client: TestClient):
        data = [
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 5.4K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_using_request_directly/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.using_request_directly.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/items/foo")
        assert response.status_code == 200
        assert response.json() == {"client_host": "testclient", "item_id": "foo"}
    
    
    def test_openapi():
        response = client.get("/openapi.json")
        assert response.status_code == 200
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 3.8K bytes
    - Viewed (0)
  5. tests/test_schema_ref_pydantic_v2.py

        async def read_root() -> Any:
            return {"$ref": "some-ref"}
    
        client = TestClient(app)
        return client
    
    
    def test_get(client: TestClient):
        response = client.get("/")
        assert response.json() == {"$ref": "some-ref"}
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("openapi.json")
        assert response.json() == snapshot(
            {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 2.1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_custom_request_and_route/test_tutorial001.py

    import gzip
    import importlib
    import json
    
    import pytest
    from fastapi import Request
    from fastapi.testclient import TestClient
    
    from tests.utils import needs_py310
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial001_py39"),
            pytest.param("tutorial001_py310", marks=needs_py310),
            pytest.param("tutorial001_an_py39"),
            pytest.param("tutorial001_an_py310", marks=needs_py310),
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_response_model/test_tutorial001_tutorial001_01.py

    import importlib
    
    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial001_py39"),
            pytest.param("tutorial001_py310", marks=needs_py310),
            pytest.param("tutorial001_01_py39"),
            pytest.param("tutorial001_01_py310", marks=needs_py310),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 6.5K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_response_model/test_tutorial004.py

    import importlib
    
    import pytest
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial004_py39"),
            pytest.param("tutorial004_py310", marks=needs_py310),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.response_model.{request.param}")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 5.3K bytes
    - Viewed (0)
  9. tests/test_return_none_stringified_annotations.py

    import http
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    
    def test_no_content():
        app = FastAPI()
    
        @app.get("/no-content", status_code=http.HTTPStatus.NO_CONTENT)
        def return_no_content() -> "None":
            return
    
        client = TestClient(app)
        response = client.get("/no-content")
        assert response.status_code == http.HTTPStatus.NO_CONTENT, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Sep 20 18:44:43 UTC 2025
    - 431 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_response_cookies/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_cookies.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Come to the dark side, we have cookies"}
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 408 bytes
    - Viewed (0)
Back to top