

def test_on_challenge(self):
    session = MockApplicationSession()
    exception = RuntimeError('such challenge')
    session.onChallenge = exception_raiser(msg)
    msg = message.Challenge('foo')
    session.onMessage(msg)
    self.assertEqual(1, len(session.errors))
    self.assertEqual(exception, session.errors[0][0])
    self.assertEqual(1, len(session._transport.messages))
    reply = session._transport.messages[0]
    self.assertIsInstance(reply, message.Abort)
    self.assertEqual('such challenge', reply.message)

dataset/ETHPy150Open crossbario/autobahn-python/autobahn/wamp/test/test_user_handler_errors.py TestSessionCallbacks.test_on_challenge/VarMisuse@29/44 `exception`->`msg`