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

Function test_handshake_protocol_unsupported

tests/test_websocket_handshake.py:134–146  ·  view source on GitHub ↗

Tests if a protocol mismatch handshake warns and returns None

(log, message, transport)

Source from the content-addressed store, hash-verified

132
133
134def test_handshake_protocol_unsupported(log, message, transport):
135 '''Tests if a protocol mismatch handshake warns and returns None'''
136 proto = 'chat'
137 message.headers.extend(gen_ws_headers('test')[0])
138
139 with log('aiohttp.websocket') as ctx:
140 _, _, _, _, protocol = websocket.do_handshake(
141 message.method, message.headers, transport,
142 protocols=[proto])
143
144 assert protocol is None
145 assert (ctx.records[-1].msg ==
146 'Client protocols %r don’t overlap server-known ones %r')

Callers

nothing calls this directly

Calls 3

gen_ws_headersFunction · 0.85
logFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected