Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for utils (0.23 sec)

  1. tests/test_tutorial/test_conditional_openapi/test_tutorial001.py

    import importlib
    
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv2
    
    
    def get_client() -> TestClient:
        from docs_src.conditional_openapi import tutorial001
    
        importlib.reload(tutorial001)
    
        client = TestClient(tutorial001.app)
        return client
    
    
    @needs_pydanticv2
    def test_disable_openapi(monkeypatch):
        monkeypatch.setenv("OPENAPI_URL", "")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_async_sql_databases/test_tutorial001.py

    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv1
    
    
    @pytest.fixture(name="app", scope="module")
    def get_app():
        with pytest.warns(DeprecationWarning):
            from docs_src.async_sql_databases.tutorial001 import app
        yield app
    
    
    # TODO: pv2 add version with Pydantic v2
    @needs_pydanticv1
    def test_create_read(app: FastAPI):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 6K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client() -> TestClient:
        from docs_src.separate_openapi_schemas.tutorial001 import app
    
        client = TestClient(app)
        return client
    
    
    def test_create_item(client: TestClient) -> None:
        response = client.post("/items/", json={"name": "Foo"})
        assert response.status_code == 200, response.text
    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)
  4. tests/test_tutorial/test_settings/test_tutorial001.py

    from fastapi.testclient import TestClient
    from pytest import MonkeyPatch
    
    from ...utils import needs_pydanticv2
    
    
    @needs_pydanticv2
    def test_settings(monkeypatch: MonkeyPatch):
        monkeypatch.setenv("ADMIN_EMAIL", "******@****.***")
        from docs_src.settings.tutorial001 import app
    
        client = TestClient(app)
        response = client.get("/info")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 552 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_schema_extra_example/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.schema_extra_example.tutorial001 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_pydanticv2
    def test_post_body_example(client: TestClient):
        response = client.put(
            "/items/5",
            json={
                "name": "Foo",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.7K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_body_updates/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv1, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.body_updates.tutorial001 import app
    
        client = TestClient(app)
        return client
    
    
    def test_get(client: TestClient):
        response = client.get("/items/baz")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 11.8K bytes
    - Viewed (0)
Back to top