Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for json (0.16 sec)

  1. tests/test_tutorial/test_async_sql_databases/test_tutorial001.py

            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"]
            assert "id" in data
            response = client.get("/notes/")
            assert response.status_code == 200, response.text
            assert data in response.json()
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 6K bytes
    - Viewed (0)
  2. 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)
  3. tests/test_tutorial/test_conditional_openapi/test_tutorial001.py

        assert response.status_code == 200
        assert response.json() == {"message": "Hello World"}
    
    
    @needs_pydanticv2
    def test_default_openapi():
        client = get_client()
        response = client.get("/docs")
        assert response.status_code == 200, response.text
        response = client.get("/redoc")
        assert response.status_code == 200, response.text
        response = client.get("/openapi.json")
        assert response.json() == {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_sub_applications/test_tutorial001.py

    
    def test_main():
        response = client.get("/app")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Hello World from main app"}
    
    
    def test_openapi_schema_sub():
        response = client.get("/subapi/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == openapi_schema_sub
    
    
    def test_sub():
    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)
  5. 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",
                        "loc": ["body", "file"],
    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)
  6. tests/test_tutorial/test_response_headers/test_tutorial001.py

    from docs_src.response_headers.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/headers/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Hello World"}
        assert response.headers["X-Cat-Dog"] == "alone in the world"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 426 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_background_tasks/test_tutorial001.py

        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 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 578 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_response_cookies/test_tutorial001.py

    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 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 403 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_request_forms/test_tutorial001.py

                    },
                ]
            }
        )
    
    
    def test_post_body_json(client: TestClient):
        response = client.post("/login/", json={"username": "Foo", "password": "secret"})
        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.5K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_openapi_webhooks/test_tutorial001.py

        assert response.status_code == 200, response.text
        assert response.json() == ["Rick", "Morty"]
    
    
    def test_dummy_webhook():
        # Just for coverage
        app.webhooks.routes[0].endpoint({})
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Oct 20 09:00:44 GMT 2023
    - 4.4K bytes
    - Viewed (2)
Back to top