Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for get_items (0.18 sec)

  1. tests/test_tutorial/test_path_operation_configurations/test_tutorial002b.py

    from fastapi.testclient import TestClient
    
    from docs_src.path_operation_configuration.tutorial002b import app
    
    client = TestClient(app)
    
    
    def test_get_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == ["Portal gun", "Plumbus"]
    
    
    def test_get_users():
        response = client.get("/users/")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  2. tests/test_infer_param_optionality.py

        assert response.json() == {"user_id": "abc123"}
    
    
    def test_get_items_1():
        """Check that /items returns expected data"""
        response = client.get("/items")
        assert response.status_code == 200, response.text
        assert response.json() == [
            {"item_id": "i1", "user_id": "u1"},
            {"item_id": "i2", "user_id": "u2"},
        ]
    
    
    def test_get_items_2():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 13.3K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_generate_clients/test_tutorial003.py

            "/users/", json={"username": "Foo", "email": "******@****.***"}
        )
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "User received"}
    
    
    def test_get_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [
            {"name": "Plumbus", "price": 3},
            {"name": "Portal Gun", "price": 9001},
        ]
    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)
  4. tests/test_tutorial/test_extra_models/test_tutorial005.py

    from fastapi.testclient import TestClient
    
    from docs_src.extra_models.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_get_items():
        response = client.get("/keyword-weights/")
        assert response.status_code == 200, response.text
        assert response.json() == {"foo": 2.3, "bar": 3.4}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_extra_models/test_tutorial004_py39.py

    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.extra_models.tutorial004_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get_items(client: TestClient):
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [
            {"name": "Foo", "description": "There comes my hero"},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_extra_models/test_tutorial005_py39.py

    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.extra_models.tutorial005_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get_items(client: TestClient):
        response = client.get("/keyword-weights/")
        assert response.status_code == 200, response.text
        assert response.json() == {"foo": 2.3, "bar": 3.4}
    
    
    @needs_py39
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.6K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_extra_models/test_tutorial004.py

    from fastapi.testclient import TestClient
    
    from docs_src.extra_models.tutorial004 import app
    
    client = TestClient(app)
    
    
    def test_get_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [
            {"name": "Foo", "description": "There comes my hero"},
            {"name": "Red", "description": "It's my aeroplane"},
        ]
    
    
    def test_openapi_schema():
    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)
  8. tests/test_tutorial/test_metadata/test_tutorial004.py

                    }
                },
                "/items/": {
                    "get": {
                        "tags": ["items"],
                        "summary": "Get Items",
                        "operationId": "get_items_items__get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2K bytes
    - Viewed (0)
  9. tests/test_extra_routes.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
    
    
    @app.api_route("/items/{item_id}", methods=["GET"])
    def get_items(item_id: str):
        return {"item_id": item_id}
    
    
    def get_not_decorated(item_id: str):
        return {"item_id": item_id}
    
    
    app.add_api_route("/items-not-decorated/{item_id}", get_not_decorated)
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  10. docs/en/docs/advanced/generate-clients.md

        ```
    
    === "Node.js"
    
        ```Javascript
        {!> ../../../docs_src/generate_clients/tutorial004.js!}
        ```
    
    With that, the operation IDs would be renamed from things like `items-get_items` to just `get_items`, that way the client generator can generate simpler method names.
    
    ### Generate a TypeScript Client with the Preprocessed OpenAPI
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.5K bytes
    - Viewed (0)
Back to top