Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 23 for foo (0.15 sec)

  1. tests/test_tutorial/test_request_files/test_tutorial001.py

                        "type": "value_error.missing",
                    }
                ]
            }
        )
    
    
    def test_post_body_json():
        response = client.post("/files/", json={"file": "Foo"})
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "missing",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.7K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_background_tasks/test_tutorial001.py

        if log.is_file():
            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/foo@example.com")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Notification sent in the background"}
        with open("./log.txt") as f:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 578 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_dataclasses/test_tutorial001.py

    
    def test_post_item():
        response = client.post("/items/", json={"name": "Foo", "price": 3})
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
            "price": 3,
            "description": None,
            "tax": None,
        }
    
    
    def test_post_invalid_item():
        response = client.post("/items/", json={"name": "Foo", "price": "invalid price"})
        assert response.status_code == 422
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 5.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_async_sql_databases/test_tutorial001.py

        yield app
    
    
    # TODO: pv2 add version with Pydantic v2
    @needs_pydanticv1
    def test_create_read(app: FastAPI):
        with TestClient(app) as client:
            note = {"text": "Foo bar", "completed": False}
            response = client.post("/notes/", json=note)
            assert response.status_code == 200, response.text
            data = response.json()
            assert data["text"] == note["text"]
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 6K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_body/test_tutorial001.py

            "tax": None,
        }
    
    
    def test_post_with_str_float_description_tax(client: TestClient):
        response = client.post(
            "/items/",
            json={"name": "Foo", "price": "50.5", "description": "Some Foo", "tax": 0.3},
        )
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
            "price": 50.5,
            "description": "Some Foo",
            "tax": 0.3,
        }
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 14.7K bytes
    - Viewed (4)
  6. tests/test_tutorial/test_additional_responses/test_tutorial001.py

    from docs_src.additional_responses.tutorial001 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 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 4.3K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_response_change_status_code/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_change_status_code.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.put("/get-or-create-task/foo")
        print(response.content)
        assert response.status_code == 200, response.text
        assert response.json() == "Listen to the Bar Fighters"
        response = client.put("/get-or-create-task/bar")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 521 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_dependencies/test_tutorial001.py

        "path,expected_status,expected_response",
        [
            ("/items", 200, {"q": None, "skip": 0, "limit": 100}),
            ("/items?q=foo", 200, {"q": "foo", "skip": 0, "limit": 100}),
            ("/items?q=foo&skip=5", 200, {"q": "foo", "skip": 5, "limit": 100}),
            ("/items?q=foo&skip=5&limit=30", 200, {"q": "foo", "skip": 5, "limit": 30}),
            ("/users", 200, {"q": None, "skip": 0, "limit": 100}),
        ],
    )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 7K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_templates/test_tutorial001.py

        from docs_src.templates.tutorial001 import app
    
        client = TestClient(app)
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
        assert (
            b'<h1><a href="http://testserver/items/foo">Item ID: foo</a></h1>'
            in response.content
        )
        response = client.get("/static/styles.css")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 22:25:37 GMT 2024
    - 910 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_body_fields/test_tutorial001.py

        client = TestClient(app)
        return client
    
    
    def test_items_5(client: TestClient):
        response = client.put("/items/5", json={"item": {"name": "Foo", "price": 3.0}})
        assert response.status_code == 200
        assert response.json() == {
            "item_id": 5,
            "item": {"name": "Foo", "price": 3.0, "description": None, "tax": None},
        }
    
    
    def test_items_6(client: TestClient):
        response = client.put(
            "/items/6",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.2K bytes
    - Viewed (0)
Back to top