Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 487 for Jest (0.16 sec)

  1. tests/test_tutorial/test_settings/test_app02.py

    from ...utils import needs_pydanticv2
    
    
    @needs_pydanticv2
    def test_settings(monkeypatch: MonkeyPatch):
        from docs_src.settings.app02 import main
    
        monkeypatch.setenv("ADMIN_EMAIL", "******@****.***")
        settings = main.get_settings()
        assert settings.app_name == "Awesome API"
        assert settings.items_per_user == 50
    
    
    @needs_pydanticv2
    def test_override_settings():
        from docs_src.settings.app02 import test_main
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 488 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_request_files/test_tutorial002.py

                "/files/",
                files=(
                    ("files", ("test.txt", file)),
                    ("files", ("test2.txt", file2)),
                ),
            )
        assert response.status_code == 200, response.text
        assert response.json() == {"file_sizes": [14, 15]}
    
    
    def test_post_upload_file(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        path2 = tmp_path / "test2.txt"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.5K bytes
    - Viewed (0)
  3. docs_src/app_testing/app_b/test_main.py

    from .main import app
    
    client = TestClient(app)
    
    
    def test_read_item():
        response = client.get("/items/foo", headers={"X-Token": "coneofsilence"})
        assert response.status_code == 200
        assert response.json() == {
            "id": "foo",
            "title": "Foo",
            "description": "There goes my hero",
        }
    
    
    def test_read_item_bad_token():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_request_files/test_tutorial003.py

                files=(
                    ("files", ("test.txt", file)),
                    ("files", ("test2.txt", file2)),
                ),
            )
        assert response.status_code == 200, response.text
        assert response.json() == {"file_sizes": [14, 15]}
    
    
    def test_post_upload_file(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        path2 = tmp_path / "test2.txt"
    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)
  5. tests/test_tutorial/test_dependencies/test_tutorial008d.py

        client = TestClient(app)
        return client
    
    
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
        assert response.json() == {"detail": "Item not found, there's only a plumbus here"}
    
    
    def test_get(client: TestClient):
        response = client.get("/items/plumbus")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  6. 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"})
    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)
  7. tests/test_tutorial/test_path_params/test_tutorial005.py

    from docs_src.path_params.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_get_enums_alexnet():
        response = client.get("/models/alexnet")
        assert response.status_code == 200
        assert response.json() == {"model_name": "alexnet", "message": "Deep Learning FTW!"}
    
    
    def test_get_enums_lenet():
        response = client.get("/models/lenet")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 5K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_header_params/test_tutorial001.py

            ("/items", {"User-Agent": "FastAPI test"}, 200, {"User-Agent": "FastAPI test"}),
        ],
    )
    def test(path, headers, expected_status, expected_response):
        response = client.get(path, headers=headers)
        assert response.status_code == expected_status
        assert response.json() == expected_response
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.8K bytes
    - Viewed (0)
  9. tests/test_tuples.py

        return values
    
    
    client = TestClient(app)
    
    
    def test_model_with_tuple_valid():
        data = {"items": [["foo", "bar"], ["baz", "whatelse"]]}
        response = client.post("/model-with-tuple/", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == data
    
    
    def test_model_with_tuple_invalid():
        data = {"items": [["foo", "bar"], ["baz", "whatelse", "too", "much"]]}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 11.8K bytes
    - Viewed (0)
  10. docs_src/async_tests/test_main.py

    import pytest
    from httpx import AsyncClient
    
    from .main import app
    
    
    @pytest.mark.anyio
    async def test_root():
        async with AsyncClient(app=app, base_url="http://test") as ac:
            response = await ac.get("/")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Oct 06 15:32:11 GMT 2021
    - 306 bytes
    - Viewed (0)
Back to top