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

Function test_decorate_view

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

Source from the content-addressed store, hash-verified

792
793
794async def test_decorate_view(aiohttp_client: AiohttpClient) -> None:
795 routes = web.RouteTableDef()
796
797 @routes.view("/a")
798 class MyView(web.View):
799 async def get(self) -> web.Response:
800 return web.Response()
801
802 async def post(self) -> web.Response:
803 return web.Response()
804
805 app = web.Application()
806 app.router.add_routes(routes)
807
808 client = await aiohttp_client(app)
809
810 r = await client.get("/a")
811 assert r.status == 200
812 await r.release()
813
814 r = await client.post("/a")
815 assert r.status == 200
816 await r.release()
817
818 r = await client.put("/a")
819 assert r.status == 405
820 await r.release()
821
822
823async def test_web_view(aiohttp_client: AiohttpClient) -> None:

Callers

nothing calls this directly

Calls 6

aiohttp_clientFunction · 0.85
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…