Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for assertj (0.18 sec)

  1. tests/test_tutorial/test_dataclasses/test_tutorial003.py

        )
        assert response.status_code == 200
        assert response.json() == {
            "name": "foo",
            "items": [
                {"name": "Bar", "description": None},
                {"name": "Baz", "description": "Drop the Baz"},
            ],
        }
    
    
    def test_get_authors():
        response = client.get("/authors/")
        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_configure_swagger_ui/test_tutorial003.py

    
    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
        ), "overridden configs should not include the old value"
        assert (
            '"syntaxHighlight": false' 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)
  3. tests/test_tutorial/test_handling_errors/test_tutorial003.py

    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
        assert response.json() == {
            "message": "Oops! yolo did something. There goes a rainbow..."
        }
    
    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_security/test_tutorial003.py

        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "Incorrect username or password"}
    
    
    def test_no_token():
        response = client.get("/users/me")
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Not authenticated"}
        assert response.headers["WWW-Authenticate"] == "Bearer"
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_events/test_tutorial003.py

        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})
            assert response.status_code == 200, response.text
            assert response.json() == {"result": 84.0}
        assert not ml_models, "ml_models should be empty"
    
    
    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)
  6. tests/test_tutorial/test_custom_request_and_route/test_tutorial003.py

    
    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"}
        assert "X-Response-Time" in response.headers
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 526 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_generate_clients/test_tutorial003.py

        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": "******@****.***"}
        )
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "User received"}
    
    
    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)
  8. tests/test_tutorial/test_extra_models/test_tutorial003.py

    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")
        assert response.status_code == 200, response.text
        assert response.json() == {
    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_path_operation_advanced_configurations/test_tutorial003.py

    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
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 575 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_additional_responses/test_tutorial003.py

    
    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
        assert response.json() == {"message": "Item not found"}
    
    
    def test_openapi_schema():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 4.5K bytes
    - Viewed (0)
Back to top