Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for Jest (0.18 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 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 12.1K bytes
    - Viewed (0)
  2. 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 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8K bytes
    - Viewed (0)
  3. 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 28 07:19:10 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 167 bytes
    - Viewed (0)
  4. 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 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  5. 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 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  6. 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 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  7. 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 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 526 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_extra_models/test_tutorial003.py

    from docs_src.extra_models.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_get_car():
        response = client.get("/items/item1")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "description": "All my friends drive a low rider",
            "type": "car",
        }
    
    
    def test_get_plane():
        response = client.get("/items/item2")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Aug 04 20:47:07 GMT 2023
    - 5.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_events/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.events.tutorial003 import (
        app,
        fake_answer_to_everything_ml_model,
        ml_models,
    )
    
    
    def test_events():
        assert not ml_models, "ml_models should be empty"
        with TestClient(app) as client:
            assert ml_models["answer_to_everything"] == fake_answer_to_everything_ml_model
            response = client.get("/predict", params={"x": 2})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  10. 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 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 575 bytes
    - Viewed (0)
Back to top