- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 93 for PASS (0.22 sec)
-
docs/en/docs/tutorial/testing.md
``` Whenever you need the client to pass information in the request and you don't know how to, you can search (Google) how to do it in `httpx`, or even how to do it with `requests`, as HTTPX's design is based on Requests' design. Then you just do the same in your tests. E.g.: * To pass a *path* or *query* parameter, add it to the URL itself. * To pass a JSON body, pass a Python object (e.g. a `dict`) to the parameter `json`.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 6.2K bytes - Viewed (0) -
tests/test_additional_responses_response_class.py
@app.get( "/a", response_class=JsonApiResponse, responses={500: {"description": "Error", "model": JsonApiError}}, ) async def a(): pass # pragma: no cover @app.get("/b", responses={500: {"description": "Error", "model": Error}}) async def b(): pass # pragma: no cover client = TestClient(app) def test_openapi_schema(): response = client.get("/openapi.json")
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 3.5K bytes - Viewed (0) -
tests/test_response_code_no_body.py
@app.get( "/a", status_code=204, response_class=JsonApiResponse, responses={500: {"description": "Error", "model": JsonApiError}}, ) async def a(): pass @app.get("/b", responses={204: {"description": "No Content"}}) async def b(): pass # pragma: no cover client = TestClient(app) def test_get_response(): response = client.get("/a") assert response.status_code == 204, response.text
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 3.2K bytes - Viewed (0) -
tests/test_additional_responses_custom_model_in_callback.py
@callback_router.get( "{$callback_url}/callback/", responses={400: {"model": CustomModel}} ) def callback_route(): pass # pragma: no cover @app.post("/", callbacks=callback_router.routes) def main_route(callback_url: HttpUrl): pass # pragma: no cover client = TestClient(app) def test_openapi_schema(): response = client.get("/openapi.json")
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 5.8K bytes - Viewed (0) -
tests/test_request_body_parameters_media_type.py
@app.post("/products") async def create_product(data: Product = Body(media_type=media_type, embed=True)): pass # pragma: no cover @app.post("/shops") async def create_shop( data: Shop = Body(media_type=media_type), included: typing.List[Product] = Body(default=[], media_type=media_type), ): pass # pragma: no cover client = TestClient(app) def test_openapi_schema():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 6.4K bytes - Viewed (0) -
tests/test_ws_router.py
pass # pragma: no cover async def ws_dependency_validate(x_missing: str = Header()): pass # pragma: no cover @router.websocket("/depends-validate/") async def router_ws_depends_validate( websocket: WebSocket, data=Depends(ws_dependency_validate) ): pass # pragma: no cover class CustomError(Exception): pass @router.websocket("/custom_error/")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sun Jun 11 19:08:14 GMT 2023 - 7.5K bytes - Viewed (0) -
tests/test_additional_properties_bool.py
class FooBaseModel(BaseModel): if PYDANTIC_V2: model_config = ConfigDict(extra="forbid") 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():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 4.2K bytes - Viewed (0) -
docs/en/docs/tutorial/middleware.md
The middleware function receives: * The `request`. * A function `call_next` that will receive the `request` as a parameter. * This function will pass the `request` to the corresponding *path operation*. * Then it returns the `response` generated by the corresponding *path operation*. * You can then modify further the `response` before returning it.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 2.9K bytes - Viewed (0) -
docs/en/docs/deployment/manually.md
---> 100% ``` </div> ...or any other ASGI server. ## Run the Server Program If you installed an ASGI server manually, you would normally need to pass an import string in a special format for it to import your FastAPI application: === "Uvicorn" <div class="termy"> ```console $ uvicorn main:app --host 0.0.0.0 --port 80
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu May 02 22:37:31 GMT 2024 - 9.2K bytes - Viewed (0) -
docs/en/docs/tutorial/body-fields.md
## Recap You can use Pydantic's `Field` to declare extra validations and metadata for model attributes.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 17 05:59:11 GMT 2023 - 3.6K bytes - Viewed (0)