MCPcopy Create free account
hub / github.com/pallets/quart / test_view

Function test_view

tests/test_views.py:21–36  ·  view source on GitHub ↗
(app: Quart)

Source from the content-addressed store, hash-verified

19
20
21async def test_view(app: Quart) -> None:
22 class Views(View):
23 methods = ["GET", "POST"]
24
25 async def dispatch_request(
26 self, *args: Any, **kwargs: Any
27 ) -> ResponseReturnValue:
28 return request.method
29
30 app.add_url_rule("/", view_func=Views.as_view("simple"))
31
32 test_client = app.test_client()
33 response = await test_client.get("/")
34 assert "GET" == (await response.get_data(as_text=True))
35 response = await test_client.put("/")
36 assert response.status_code == 405
37
38
39async def test_method_view(app: Quart) -> None:

Callers

nothing calls this directly

Calls 5

as_viewMethod · 0.80
test_clientMethod · 0.45
getMethod · 0.45
get_dataMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…