Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 40 for apps (0.15 sec)

  1. tests/test_tutorial/test_sub_applications/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.sub_applications.tutorial001 import app
    
    client = TestClient(app)
    
    openapi_schema_main = {
        "openapi": "3.1.0",
        "info": {"title": "FastAPI", "version": "0.1.0"},
        "paths": {
            "/app": {
                "get": {
                    "responses": {
                        "200": {
                            "description": "Successful Response",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.9K 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_request_files/test_tutorial001.py

    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.request_files.tutorial001 import app
    
    client = TestClient(app)
    
    
    file_required = {
        "detail": [
            {
                "loc": ["body", "file"],
                "msg": "field required",
                "type": "value_error.missing",
            }
        ]
    }
    
    
    def test_post_form_no_body():
        response = client.post("/files/")
    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)
  4. tests/test_tutorial/test_events/test_tutorial001.py

    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="app", scope="module")
    def get_app():
        with pytest.warns(DeprecationWarning):
            from docs_src.events.tutorial001 import app
        yield app
    
    
    def test_events(app: FastAPI):
        with TestClient(app) as client:
            response = client.get("/items/foo")
            assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_templates/test_tutorial001.py

            shutil.rmtree("./templates")
        shutil.copytree("./docs_src/templates/templates/", "./templates")
        shutil.copytree("./docs_src/templates/static/", "./static")
        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>'
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 22:25:37 GMT 2024
    - 910 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_cors/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.cors.tutorial001 import app
    
    
    def test_cors():
        client = TestClient(app)
        # Test pre-flight response
        headers = {
            "Origin": "https://localhost.tiangolo.com",
            "Access-Control-Request-Method": "GET",
            "Access-Control-Request-Headers": "X-Example",
        }
        response = client.options("/", headers=headers)
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 1.2K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_extending_openapi/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.extending_openapi.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [{"name": "Foo"}]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py

    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)
  9. tests/test_tutorial/test_dependencies/test_tutorial001.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.dependencies.tutorial001 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/items", 200, {"q": None, "skip": 0, "limit": 100}),
            ("/items?q=foo", 200, {"q": "foo", "skip": 0, "limit": 100}),
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 7K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_body_fields/test_tutorial001.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.body_fields.tutorial001 import app
    
        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() == {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.2K bytes
    - Viewed (0)
Back to top