def test_negotiation_of_known_subprotocol_succeeds(increment_response): assert_successful_upgrade(increment_response) headers = increment_response.headers protocol = headers.getRawHeaders("Sec-WebSocket-Protocol") assert len(protocol) == 1 assert protocol[0] == 'dumb-increment-protocol'
def test_same_Origin_is_allowed(good_origin_response): assert_successful_upgrade(good_origin_response)
def test_valid_handshake_is_upgraded_correctly(success_response): assert_successful_upgrade(success_response)
def test_explicitly_trusted_Origins_are_allowed(trusted_origin_response): assert_successful_upgrade(trusted_origin_response)
def test_mismatched_Origins_are_allowed_with_OriginCheck_Off(agent): response = yield make_request(agent, path='/no-origin-check', origin='http://not-my-origin.com') assert_successful_upgrade(response) client.readBody(response).cancel() # immediately close the connection
def test_no_subprotocol_is_negotiated_by_default(agent): response = yield make_request(agent, protocol="my_protocol") assert_successful_upgrade(response) protocol = response.headers.getRawHeaders("Sec-WebSocket-Protocol") assert protocol is None