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

Function test_handshake_protocol_agreement

tests/test_websocket_handshake.py:120–131  ·  view source on GitHub ↗

Tests if the right protocol is selected given multiple

(message, transport)

Source from the content-addressed store, hash-verified

118
119
120def test_handshake_protocol_agreement(message, transport):
121 '''Tests if the right protocol is selected given multiple'''
122 best_proto = 'worse_proto'
123 wanted_protos = ['best', 'chat', 'worse_proto']
124 server_protos = 'worse_proto,chat'
125
126 message.headers.extend(gen_ws_headers(server_protos)[0])
127 _, resp_headers, _, _, protocol = websocket.do_handshake(
128 message.method, message.headers, transport,
129 protocols=wanted_protos)
130
131 assert protocol == best_proto
132
133
134def test_handshake_protocol_unsupported(log, message, transport):

Callers

nothing calls this directly

Calls 2

gen_ws_headersFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected