Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for Dost (0.14 sec)

  1. tests/test_tutorial/test_request_files/test_tutorial001.py

            }
        )
    
    
    def test_post_file(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
        client = TestClient(app)
        with path.open("rb") as file:
            response = client.post("/files/", files={"file": file})
        assert response.status_code == 200, response.text
        assert response.json() == {"file_size": 14}
    
    
    def test_post_large_file(tmp_path):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.7K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_response_cookies/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_cookies.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Come to the dark side, we have cookies"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 403 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_dataclasses/test_tutorial001.py

    client = TestClient(app)
    
    
    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"})
    Python
    - Registered: Sun Apr 21 07:19:11 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

    
    # 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"]
            assert data["completed"] == note["completed"]
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 6K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_background_tasks/test_tutorial001.py

    from docs_src.background_tasks.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test():
        log = Path("log.txt")
        if log.is_file():
            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***")
        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 21 07:19:11 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 578 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py

                                    }
                                },
                            }
                        },
                    },
                    "post": {
                        "summary": "Create Item",
                        "operationId": "create_item_items__post",
                        "requestBody": {
                            "content": {
                                "application/json": {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 4.8K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_body/test_tutorial001.py

    def test_body_float(client: TestClient):
        response = client.post("/items/", json={"name": "Foo", "price": 50.5})
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
            "price": 50.5,
            "description": None,
            "tax": None,
        }
    
    
    def test_post_with_str_float(client: TestClient):
        response = client.post("/items/", json={"name": "Foo", "price": "50.5"})
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 14.7K bytes
    - Viewed (4)
  8. tests/test_tutorial/test_request_forms/test_tutorial001.py

        client = TestClient(app)
        return client
    
    
    def test_post_body_form(client: TestClient):
        response = client.post("/login/", data={"username": "Foo", "password": "secret"})
        assert response.status_code == 200
        assert response.json() == {"username": "Foo"}
    
    
    def test_post_body_form_no_password(client: TestClient):
        response = client.post("/login/", data={"username": "Foo"})
        assert response.status_code == 422
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.5K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_openapi_webhooks/test_tutorial001.py

                "new-subscription": {
                    "post": {
                        "summary": "New Subscription",
                        "description": "When a new user subscribes to your service we'll send you a POST request with this\ndata to the URL that you register for the event `new-subscription` in the dashboard.",
                        "operationId": "new_subscriptionnew_subscription_post",
                        "requestBody": {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Oct 20 09:00:44 GMT 2023
    - 4.4K bytes
    - Viewed (2)
  10. tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py

        return app
    
    
    @pytest.fixture(name="client")
    def get_client(app: FastAPI):
        client = TestClient(app)
        return client
    
    
    def test_post_form_no_body(client: TestClient):
        response = client.post("/files/")
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 9.8K bytes
    - Viewed (0)
Back to top