def test_handshake_protocol(message, transport):
 proto = 'chat'
 message.headers.extend(gen_ws_headers(proto)[0])
 (_, resp_headers, _, _, protocol) = do_handshake(message.method, message.headers, transport, protocols=[proto])
 assert (protocol == proto)
 resp_headers = dict(resp_headers)
 assert (resp_headers['Sec-Websocket-Protocol'] == proto)

def test_handshake_protocol ( message , transport ) : proto = 'chat' message . headers . extend ( gen_ws_headers ( proto ) [ 0 ] ) ( _ , resp_headers , _ , _ , protocol ) = do_handshake ( message . method , message . headers , transport , protocols = [ proto ] ) assert ( protocol == proto ) resp_headers = dict ( resp_headers ) assert ( resp_headers [ 'Sec-Websocket-Protocol' ] == proto )
tests if one protocol is returned by do_handshake .