| Conditions | 2 |
| Total Lines | 17 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import aiohttp_rpc |
||
| 5 | async def test_middleware(aiohttp_client): |
||
| 6 | def method(): |
||
| 7 | return 'ok' |
||
| 8 | |||
| 9 | async def test_middleware(request, handler): |
||
| 10 | request.method = 'method' |
||
| 11 | response = await handler(request) |
||
| 12 | response.result += '!' |
||
| 13 | return response |
||
| 14 | |||
| 15 | rpc_server = aiohttp_rpc.JsonRpcServer(middlewares=(test_middleware,)) |
||
| 16 | rpc_server.add_method(method) |
||
| 17 | |||
| 18 | client = await utils.make_client(aiohttp_client, rpc_server) |
||
| 19 | |||
| 20 | async with aiohttp_rpc.JsonRpcClient('/rpc', session=client) as rpc: |
||
| 21 | assert await rpc.call('my_method') == 'ok!' |
||
| 22 |