Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 537 for foo (0.16 sec)

  1. docs_src/app_testing/app_b_an/test_main.py

    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():
        response = client.get("/items/foo", headers={"X-Token": "hailhydra"})
        assert response.status_code == 400
    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)
  2. tests/test_tutorial/test_body/test_tutorial001.py

            "tax": None,
        }
    
    
    def test_post_with_str_float_description_tax(client: TestClient):
        response = client.post(
            "/items/",
            json={"name": "Foo", "price": "50.5", "description": "Some Foo", "tax": 0.3},
        )
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
            "price": 50.5,
            "description": "Some Foo",
            "tax": 0.3,
        }
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 14.7K bytes
    - Viewed (4)
  3. tests/test_tutorial/test_body/test_tutorial001_py310.py

            "tax": None,
        }
    
    
    @needs_py310
    def test_post_with_str_float_description_tax(client: TestClient):
        response = client.post(
            "/items/",
            json={"name": "Foo", "price": "50.5", "description": "Some Foo", "tax": 0.3},
        )
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
            "price": 50.5,
            "description": "Some Foo",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 15K bytes
    - Viewed (1)
  4. tests/test_additional_properties_bool.py

        else:
    
            class Config:
                extra = "forbid"
    
    
    class Foo(FooBaseModel):
        pass
    
    
    app = FastAPI()
    
    
    @app.post("/")
    async def post(
        foo: Union[Foo, None] = None,
    ):
        return foo
    
    
    client = TestClient(app)
    
    
    def test_call_invalid():
        response = client.post("/", json={"foo": {"bar": "baz"}})
        assert response.status_code == 422
    
    
    def test_call_valid():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.2K bytes
    - Viewed (0)
  5. tests/test_additional_properties.py

    class Items(BaseModel):
        items: Dict[str, int]
    
    
    @app.post("/foo")
    def foo(items: Items):
        return items.items
    
    
    client = TestClient(app)
    
    
    def test_additional_properties_post():
        response = client.post("/foo", json={"items": {"foo": 1, "bar": 2}})
        assert response.status_code == 200, response.text
        assert response.json() == {"foo": 1, "bar": 2}
    
    
    def test_openapi_schema():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  6. tests/test_query.py

        assert response.status_code == 200
        assert response.json() == "foo bar"
    
    
    def test_query_int_optional_query_50():
        response = client.get("/query/int/optional?query=50")
        assert response.status_code == 200
        assert response.json() == "foo bar 50"
    
    
    def test_query_int_optional_query_foo():
        response = client.get("/query/int/optional?query=foo")
        assert response.status_code == 422
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 11.4K bytes
    - Viewed (0)
  7. tests/test_response_by_alias.py

        return {"alias": "Foo"}
    
    
    @app.get("/by-alias/model", response_model=Model)
    def by_alias_model():
        return Model(alias="Foo")
    
    
    @app.get("/by-alias/list", response_model=List[Model])
    def by_alias_list():
        return [{"alias": "Foo"}, {"alias": "Bar"}]
    
    
    @app.get("/no-alias/dict", response_model=ModelNoAlias)
    def no_alias_dict():
        return {"name": "Foo"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 11.1K bytes
    - Viewed (0)
  8. tests/test_compat.py

        config = _get_model_config(foo)
        assert config == {"from_attributes": True}
    
    
    def test_complex():
        app = FastAPI()
    
        @app.post("/")
        def foo(foo: Union[str, List[int]]):
            return foo
    
        client = TestClient(app)
    
        response = client.post("/", json="bar")
        assert response.status_code == 200, response.text
        assert response.json() == "bar"
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_testing_dependencies/test_tutorial001_py310.py

    @needs_py310
    def test_override_in_users_with_q():
        from docs_src.dependency_testing.tutorial001_py310 import client
    
        response = client.get("/users/?q=foo")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "message": "Hello Users!",
            "params": {"q": "foo", "skip": 5, "limit": 10},
        }
    
    
    @needs_py310
    def test_override_in_users_with_params():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2K bytes
    - Viewed (0)
  10. docs_src/dependency_testing/tutorial001_py310.py

        }
    
    
    def test_override_in_items_with_q():
        response = client.get("/items/?q=foo")
        assert response.status_code == 200
        assert response.json() == {
            "message": "Hello Items!",
            "params": {"q": "foo", "skip": 5, "limit": 10},
        }
    
    
    def test_override_in_items_with_params():
        response = client.get("/items/?q=foo&skip=100&limit=200")
        assert response.status_code == 200
        assert response.json() == {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.4K bytes
    - Viewed (0)
Back to top