Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 509 for testclient (0.04 sec)

  1. tests/test_tutorial/test_response_cookies/test_tutorial002.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_cookies.tutorial002_py39 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie-and-object/")
        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
    - 419 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_wsgi/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.wsgi.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_flask():
        response = client.get("/v1/")
        assert response.status_code == 200, response.text
        assert response.text == "Hello, World from Flask!"
    
    
    def test_app():
        response = client.get("/v2")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 441 bytes
    - Viewed (1)
  3. tests/test_tutorial/test_dataclasses/test_tutorial001.py

    import pytest
    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),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.dataclasses_.{request.param}")
    
        client = TestClient(mod.app)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 4.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_extra_models/test_tutorial001_tutorial002.py

    import importlib
    
    import pytest
    from dirty_equals import IsList
    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("tutorial002_py39"),
            pytest.param("tutorial002_py310", marks=needs_py310),
        ],
    )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 5.5K bytes
    - Viewed (0)
  5. tests/test_union_body_discriminator_annotated.py

    from typing import Annotated, Union
    
    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    from pydantic import BaseModel
    
    
    @pytest.fixture(name="client")
    def client_fixture() -> TestClient:
        from fastapi import Body
        from pydantic import Discriminator, Tag
    
        class Cat(BaseModel):
            pet_type: str = "cat"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 7.7K bytes
    - Viewed (0)
  6. tests/test_router_prefix_with_template.py

    from fastapi import APIRouter, FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    router = APIRouter()
    
    
    @router.get("/users/{id}")
    def read_user(segment: str, id: str):
        return {"segment": segment, "id": id}
    
    
    app.include_router(router, prefix="/{segment}")
    
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/seg/users/foo")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Apr 08 04:37:38 UTC 2020
    - 484 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_request_files/test_tutorial001_03.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            "tutorial001_03_py39",
            "tutorial001_03_an_py39",
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.request_files.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_post_file(tmp_path, client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 6.2K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_response_model/test_tutorial005.py

        client = TestClient(mod.app)
        return client
    
    
    def test_read_item_name(client: TestClient):
        response = client.get("/items/bar/name")
        assert response.status_code == 200, response.text
        assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
    
    
    def test_read_item_public_data(client: TestClient):
        response = client.get("/items/bar/public")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.5K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_response_model/test_tutorial006.py

        client = TestClient(mod.app)
        return client
    
    
    def test_read_item_name(client: TestClient):
        response = client.get("/items/bar/name")
        assert response.status_code == 200, response.text
        assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
    
    
    def test_read_item_public_data(client: TestClient):
        response = client.get("/items/bar/public")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.5K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_custom_response/test_tutorial001b.py

    from fastapi.testclient import TestClient
    
    from docs_src.custom_response.tutorial001b_py39 import app
    
    client = TestClient(app)
    
    
    def test_get_custom_response():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [{"item_id": "Foo"}]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1K bytes
    - Viewed (0)
Back to top