Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for cdef (0.2 sec)

  1. tests/test_tutorial/test_dataclasses/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.dataclasses.tutorial003 import app
    
    from ...utils import needs_pydanticv1, needs_pydanticv2
    
    client = TestClient(app)
    
    
    def test_post_authors_item():
        response = client.post(
            "/authors/foo/items/",
            json=[{"name": "Bar"}, {"name": "Baz", "description": "Drop the Baz"}],
        )
        assert response.status_code == 200
        assert response.json() == {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 12.1K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_handling_errors/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.handling_errors.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/unicorns/shinny")
        assert response.status_code == 200, response.text
        assert response.json() == {"unicorn_name": "shinny"}
    
    
    def test_get_exception():
        response = client.get("/unicorns/yolo")
        assert response.status_code == 418, response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_configure_swagger_ui/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.configure_swagger_ui.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_swagger_ui():
        response = client.get("/docs")
        assert response.status_code == 200, response.text
        assert (
            '"deepLinking": false,' in response.text
        ), "overridden configs should be preserved"
        assert (
            '"deepLinking": true' not in response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_security/test_tutorial003.py

    from docs_src.security.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_login():
        response = client.post("/token", data={"username": "johndoe", "password": "secret"})
        assert response.status_code == 200, response.text
        assert response.json() == {"access_token": "johndoe", "token_type": "bearer"}
    
    
    def test_login_incorrect_password():
        response = client.post(
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_testing/test_tutorial003.py

    import pytest
    
    
    def test_main():
        with pytest.warns(DeprecationWarning):
            from docs_src.app_testing.tutorial003 import test_read_items
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 167 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial003.py

    from docs_src.path_operation_advanced_configuration.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_get():
        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
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 575 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_additional_responses/test_tutorial003.py

    from docs_src.additional_responses.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"id": "foo", "value": "there goes my hero"}
    
    
    def test_path_operation_not_found():
        response = client.get("/items/bar")
        assert response.status_code == 404, response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_header_params/test_tutorial003.py

                200,
                {"X-Token values": ["foo", "bar"]},
            ),
        ],
    )
    def test(path, headers, expected_status, expected_response):
        response = client.get(path, headers=headers)
        assert response.status_code == expected_status
        assert response.json() == expected_response
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jan 12 14:52:00 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_generate_clients/test_tutorial003.py

    from docs_src.generate_clients.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_post_items():
        response = client.post("/items/", json={"name": "Foo", "price": 5})
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Item received"}
    
    
    def test_post_users():
        response = client.post(
            "/users/", json={"username": "Foo", "email": "******@****.***"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_custom_request_and_route/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.custom_request_and_route.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/")
        assert response.json() == {"message": "Not timed"}
        assert "X-Response-Time" not in response.headers
    
    
    def test_get_timed():
        response = client.get("/timed")
        assert response.json() == {"message": "It's the time of my life"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 526 bytes
    - Viewed (0)
Back to top