MCPcopy
hub / github.com/aio-libs/aiohttp / test_web_view

Function test_web_view

tests/test_web_urldispatcher.py:823–847  ·  view source on GitHub ↗
(aiohttp_client: AiohttpClient)

Source from the content-addressed store, hash-verified

821
822
823async def test_web_view(aiohttp_client: AiohttpClient) -> None:
824 app = web.Application()
825
826 class MyView(web.View):
827 async def get(self) -> web.Response:
828 return web.Response()
829
830 async def post(self) -> web.Response:
831 return web.Response()
832
833 app.router.add_routes([web.view("/a", MyView)])
834
835 client = await aiohttp_client(app)
836
837 r = await client.get("/a")
838 assert r.status == 200
839 await r.release()
840
841 r = await client.post("/a")
842 assert r.status == 200
843 await r.release()
844
845 r = await client.put("/a")
846 assert r.status == 405
847 await r.release()
848
849
850async def test_static_absolute_url(

Callers

nothing calls this directly

Calls 7

aiohttp_clientFunction · 0.85
viewMethod · 0.80
add_routesMethod · 0.45
getMethod · 0.45
releaseMethod · 0.45
postMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…