tests.utils   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A make_client() 0 4 1
A make_ws_client() 0 5 1
1
import aiohttp
2
from aiohttp import web
3
4
import aiohttp_rpc
5
6
7
async def make_client(aiohttp_client, rpc_server: aiohttp_rpc.JsonRpcServer) -> aiohttp.ClientSession:
8
    app = web.Application()
9
    app.router.add_post('/rpc', rpc_server.handle_http_request)
10
    return await aiohttp_client(app)
11
12
13
async def make_ws_client(aiohttp_client, rpc_server: aiohttp_rpc.WsJsonRpcServer) -> aiohttp.ClientSession:
14
    app = web.Application()
15
    app.router.add_get('/rpc', rpc_server.handle_http_request)
16
    app.on_shutdown.append(rpc_server.on_shutdown)
17
    return await aiohttp_client(app)
18