Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 227 for p2_test (0.12 sec)

  1. tests/test_tutorial/test_dependencies/test_tutorial008b_an_py39.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008b_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 918 bytes
    - Viewed (0)
  2. tests/test_datastructures.py

    from typing import List
    
    import pytest
    from fastapi import FastAPI, UploadFile
    from fastapi.datastructures import Default
    from fastapi.testclient import TestClient
    
    
    # TODO: remove when deprecating Pydantic v1
    def test_upload_file_invalid():
        with pytest.raises(ValueError):
            UploadFile.validate("not a Starlette UploadFile")
    
    
    def test_upload_file_invalid_pydantic_v2():
        with pytest.raises(ValueError):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 18 12:36:40 UTC 2023
    - 2K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_extra_models/test_tutorial005_py39.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.extra_models.tutorial005_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get_items(client: TestClient):
        response = client.get("/keyword-weights/")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_websockets/test_tutorial002_py310.py

        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws"):
                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
                )  # pragma: no cover
    
    
    @needs_py310
    def test_websocket_invalid_data(app: FastAPI):
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_dependencies/test_tutorial001_an_py310.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial001_an_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 7.2K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_additional_status_codes/test_tutorial001_py310.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.additional_status_codes.tutorial001_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_update(client: TestClient):
        response = client.put("/items/foo", json={"name": "Wrestlers"})
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 738 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_dependencies/test_tutorial001_an_py39.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial001_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 7.2K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_custom_request_and_route/test_tutorial001.py

    import gzip
    import json
    
    import pytest
    from fastapi import Request
    from fastapi.testclient import TestClient
    
    from docs_src.custom_request_and_route.tutorial001 import app
    
    
    @app.get("/check-class")
    async def check_gzip_request(request: Request):
        return {"request_class": type(request).__name__}
    
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize("compress", [True, False])
    def test_gzip_request(compress):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Nov 13 14:26:09 UTC 2022
    - 886 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_websockets/test_tutorial002.py

    def test_websocket_no_credentials():
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws"):
                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
                )  # pragma: no cover
    
    
    def test_websocket_invalid_data():
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Nov 13 14:26:09 UTC 2022
    - 3.6K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_dependencies/test_tutorial008c.py

    import pytest
    from fastapi.exceptions import FastAPIError
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008c import app
    
        client = TestClient(app)
        return client
    
    
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 1.1K bytes
    - Viewed (0)
Back to top