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

Function test_handshake_protocol

tests/test_websocket_handshake.py:104–117  ·  view source on GitHub ↗

Tests if one protocol is returned by do_handshake

(message, transport)

Source from the content-addressed store, hash-verified

102
103
104def test_handshake_protocol(message, transport):
105 '''Tests if one protocol is returned by do_handshake'''
106 proto = 'chat'
107
108 message.headers.extend(gen_ws_headers(proto)[0])
109 _, resp_headers, _, _, protocol = websocket.do_handshake(
110 message.method, message.headers, transport,
111 protocols=[proto])
112
113 assert protocol == proto
114
115 # also test if we reply with the protocol
116 resp_headers = dict(resp_headers)
117 assert resp_headers['SEC-WEBSOCKET-PROTOCOL'] == proto
118
119
120def test_handshake_protocol_agreement(message, transport):

Callers

nothing calls this directly

Calls 2

gen_ws_headersFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected