Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 45 of 45 for import (0.13 sec)

  1. tests/test_tutorial/test_security/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.security.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_no_token():
        response = client.get("/items")
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Not authenticated"}
        assert response.headers["WWW-Authenticate"] == "Bearer"
    
    
    def test_token():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_body_updates/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv1, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.body_updates.tutorial001 import app
    
        client = TestClient(app)
        return client
    
    
    def test_get(client: TestClient):
        response = client.get("/items/baz")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 11.8K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_handling_errors/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.handling_errors.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_get_item():
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"item": "The Foo Wrestlers"}
    
    
    def test_get_item_not_found():
        response = client.get("/items/bar")
        assert response.status_code == 404, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_openapi_callbacks/test_tutorial001.py

    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.openapi_callbacks.tutorial001 import app, invoice_notification
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.post(
            "/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3}
        )
        assert response.status_code == 200, response.text
        assert response.json() == {"msg": "Invoice received"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 9K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_testing_dependencies/test_tutorial001.py

    from docs_src.dependency_testing.tutorial001 import (
        app,
        client,
        test_override_in_items,
        test_override_in_items_with_params,
        test_override_in_items_with_q,
    )
    
    
    def test_override_in_items_run():
        test_override_in_items()
    
    
    def test_override_in_items_with_q_run():
        test_override_in_items_with_q()
    
    
    def test_override_in_items_with_params_run():
        test_override_in_items_with_params()
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 10 09:08:19 GMT 2020
    - 1.5K bytes
    - Viewed (0)
Back to top