Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 131 for parametrize (0.23 sec)

  1. tests/test_param_include_in_schema.py

    def test_openapi_schema():
        client = TestClient(app)
        response = client.get("/openapi.json")
        assert response.status_code == 200
        assert response.json() == openapi_schema
    
    
    @pytest.mark.parametrize(
        "path,cookies,expected_status,expected_response",
        [
            (
                "/hidden_cookie",
                {},
                200,
                {"hidden_cookie": None},
            ),
            (
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 7.4K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_custom_request_and_route/test_tutorial001.py

    
    @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):
        n = 1000
        headers = {}
        body = [1] * n
        data = json.dumps(body).encode()
        if compress:
            data = gzip.compress(data)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Nov 13 14:26:09 GMT 2022
    - 886 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_first_steps/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    from docs_src.first_steps.tutorial001 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/", 200, {"message": "Hello World"}),
            ("/nonexistent", 404, {"detail": "Not Found"}),
        ],
    )
    def test_get_path(path, expected_status, expected_response):
        response = client.get(path)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_cookie_params/test_tutorial001_an_py310.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @needs_py310
    @pytest.mark.parametrize(
        "path,cookies,expected_status,expected_response",
        [
            ("/items", None, 200, {"ads_id": None}),
            ("/items", {"ads_id": "ads_track"}, 200, {"ads_id": "ads_track"}),
            (
                "/items",
                {"ads_id": "ads_track", "session": "cookiesession"},
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_dependencies/test_tutorial004_an.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.dependencies.tutorial004_an import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            (
                "/items",
                200,
                {
                    "items": [
                        {"item_name": "Foo"},
                        {"item_name": "Bar"},
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.4K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_header_params/test_tutorial001_an.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.header_params.tutorial001_an import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,headers,expected_status,expected_response",
        [
            ("/items", None, 200, {"User-Agent": "testclient"}),
            ("/items", {"X-Header": "notvalid"}, 200, {"User-Agent": "testclient"}),
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.8K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_cookie_params/test_tutorial001_an_py39.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @needs_py39
    @pytest.mark.parametrize(
        "path,cookies,expected_status,expected_response",
        [
            ("/items", None, 200, {"ads_id": None}),
            ("/items", {"ads_id": "ads_track"}, 200, {"ads_id": "ads_track"}),
            (
                "/items",
                {"ads_id": "ads_track", "session": "cookiesession"},
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_header_params/test_tutorial003_an_py39.py

    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.header_params.tutorial003_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    @pytest.mark.parametrize(
        "path,headers,expected_status,expected_response",
        [
            ("/items", None, 200, {"X-Token values": None}),
            ("/items", {"x-token": "foo"}, 200, {"X-Token values": ["foo"]}),
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.3K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_cookie_params/test_tutorial001_an.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.cookie_params.tutorial001_an import app
    
    
    @pytest.mark.parametrize(
        "path,cookies,expected_status,expected_response",
        [
            ("/items", None, 200, {"ads_id": None}),
            ("/items", {"ads_id": "ads_track"}, 200, {"ads_id": "ads_track"}),
            (
                "/items",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_header_params/test_tutorial002.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.header_params.tutorial002 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,headers,expected_status,expected_response",
        [
            ("/items", None, 200, {"strange_header": None}),
            ("/items", {"X-Header": "notvalid"}, 200, {"strange_header": None}),
            (
                "/items",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4K bytes
    - Viewed (0)
Back to top