Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 505 for TestClient (0.21 sec)

  1. fastapi/testclient.py

    from starlette.testclient import TestClient as TestClient  # noqa...
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2020-12-20 18:50
    - 66 bytes
    - Viewed (0)
  2. docs/en/docs/reference/testclient.md

    You can use the `TestClient` class to test FastAPI applications without creating an actual HTTP and socket connection, just communicating directly with the FastAPI code.
    
    Read more about it in the
    [FastAPI docs for Testing](https://fastapi.tiangolo.com/tutorial/testing/).
    
    You can import it directly from `fastapi.testclient`:
    
    ```python
    from fastapi.testclient import TestClient
    ```
    
    Plain Text
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-10-18 12:36
    - 450 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_security/test_tutorial005_an_py39.py

    from dirty_equals import IsDict, IsOneOf
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.security.tutorial005_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    def get_access_token(
        *, username="johndoe", password="secret", scope=None, client: TestClient
    ):
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-08-04 20:47
    - 16.3K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_security/test_tutorial005_py310.py

    from dirty_equals import IsDict, IsOneOf
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.security.tutorial005_py310 import app
    
        client = TestClient(app)
        return client
    
    
    def get_access_token(
        *, username="johndoe", password="secret", scope=None, client: TestClient
    ):
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-08-04 20:47
    - 16.3K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_websockets/test_tutorial002_an.py

    import pytest
    from fastapi.testclient import TestClient
    from fastapi.websockets import WebSocketDisconnect
    
    from docs_src.websockets.tutorial002_an import app
    
    
    def test_main():
        client = TestClient(app)
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert b"<!DOCTYPE html>" in response.content
    
    
    def test_websocket_with_cookie():
        client = TestClient(app, cookies={"session": "fakesession"})
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-03-18 12:29
    - 3.6K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial007_pv1.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv1
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.path_operation_advanced_configuration.tutorial007_pv1 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_pydanticv1
    def test_post(client: TestClient):
        yaml_data = """
            name: Deadpoolio
            tags:
            - x-force
            - x-men
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-07-07 17:12
    - 3.2K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial007.py

    import pytest
    from fastapi.testclient import TestClient
    from fastapi.utils import match_pydantic_error_url
    
    from ...utils import needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.path_operation_advanced_configuration.tutorial007 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_pydanticv2
    def test_post(client: TestClient):
        yaml_data = """
            name: Deadpoolio
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-07-07 17:12
    - 3.5K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_query_params_str_validations/test_tutorial014_py310.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.query_params_str_validations.tutorial014_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_hidden_query(client: TestClient):
        response = client.get("/items?hidden_query=somevalue")
        assert response.status_code == 200, response.text
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-06-30 18:25
    - 3.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001_py310.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client() -> TestClient:
        from docs_src.separate_openapi_schemas.tutorial001_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_create_item(client: TestClient) -> None:
        response = client.post("/items/", json={"name": "Foo"})
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-09-28 04:14
    - 4.9K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client() -> TestClient:
        from docs_src.separate_openapi_schemas.tutorial002 import app
    
        client = TestClient(app)
        return client
    
    
    def test_create_item(client: TestClient) -> None:
        response = client.post("/items/", json={"name": "Foo"})
        assert response.status_code == 200, response.text
    Python
    - Registered: 2024-02-25 07:19
    - Last Modified: 2023-08-25 19:10
    - 4.8K bytes
    - Viewed (0)
Back to top