Search Options

Results per page
Sort
Preferred Languages
Advance

Results 91 - 100 of 518 for testclient (0.05 sec)

  1. tests/test_tutorial/test_path_params_numeric_validations/test_tutorial006.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            pytest.param("tutorial006_py39"),
            pytest.param("tutorial006_an_py39"),
        ],
    )
    def get_client(request: pytest.FixtureRequest) -> TestClient:
        mod = importlib.import_module(
            f"docs_src.path_params_numeric_validations.{request.param}"
        )
        return TestClient(mod.app)
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7.3K bytes
    - Viewed (0)
  2. docs/de/docs/advanced/async-tests.md

    Der `TestClient` betreibt unter der Haube etwas Magie, um die asynchrone FastAPI-Anwendung in Ihren normalen `def`-Testfunktionen, mithilfe von Standard-Pytest aufzurufen. Aber diese Magie funktioniert nicht mehr, wenn wir sie in asynchronen Funktionen verwenden. Durch die asynchrone Ausführung unserer Tests können wir den `TestClient` nicht mehr in unseren Testfunktionen verwenden.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 4.5K bytes
    - Viewed (1)
  3. docs_src/settings/app02_py39/test_main.py

    from fastapi.testclient import TestClient
    
    from .config import Settings
    from .main import app, get_settings
    
    client = TestClient(app)
    
    
    def get_settings_override():
        return Settings(admin_email="******@****.***")
    
    
    app.dependency_overrides[get_settings] = get_settings_override
    
    
    def test_app():
        response = client.get("/info")
        data = response.json()
        assert data == {
            "app_name": "Awesome API",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 515 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_path_params_numeric_validations/test_tutorial004.py

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

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            "tutorial001_py39",
            "tutorial001_an_py39",
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.request_form_models.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_post_body_form(client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 5.7K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_request_forms/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="client",
        params=[
            "tutorial001_py39",
            "tutorial001_an_py39",
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.request_forms.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    def test_post_body_form(client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 5.7K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_configure_swagger_ui/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.configure_swagger_ui.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_swagger_ui():
        response = client.get("/docs")
        assert response.status_code == 200, response.text
        assert '"syntaxHighlight": false' in response.text, (
            "syntaxHighlight should be included and converted to JSON"
        )
        assert '"dom_id": "#swagger-ui"' in response.text, (
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_metadata/test_tutorial001_1.py

    from fastapi.testclient import TestClient
    
    from docs_src.metadata.tutorial001_1_py39 import app
    
    client = TestClient(app)
    
    
    def test_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [{"name": "Katana"}]
    
    
    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
    - 1.7K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_sub_applications/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.sub_applications.tutorial001_py39 import app
    
    client = TestClient(app)
    
    openapi_schema_main = {
        "openapi": "3.1.0",
        "info": {"title": "FastAPI", "version": "0.1.0"},
        "paths": {
            "/app": {
                "get": {
                    "responses": {
                        "200": {
                            "description": "Successful Response",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.9K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_custom_response/test_tutorial009b.py

    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.custom_response import tutorial009b_py39
    from docs_src.custom_response.tutorial009b_py39 import app
    
    client = TestClient(app)
    
    
    def test_get(tmp_path: Path):
        file_path: Path = tmp_path / "large-video-file.mp4"
        tutorial009b_py39.some_file_path = str(file_path)
        test_content = b"Fake video bytes"
        file_path.write_bytes(test_content)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 505 bytes
    - Viewed (0)
Back to top