def test_format_error_response(self): arguments = MockArgumentParser() client = SanicRestBotClient("sanic", arguments) self.assertIsNotNone(client) response = client.format_error_response("1234567890", "Hello", "Something Bad") self.assertIsNotNone(response) self.assertEquals("1234567890", response['userid']) self.assertEquals("Hello", response['question']) self.assertEquals("", response['answer']) self.assertEquals("Something Bad", response['error'])
def test_format_error_response(self): arguments = MockArgumentParser() client = SanicRestBotClient("sanic", arguments) self.assertIsNotNone(client) response = client.format_error_response("1234567890", "Hello", "Something Bad") self.assertIsNotNone(response) self.assertEqual("1234567890", response['userid']) self.assertEqual("Hello", response['question']) self.assertEqual("", response['answer']) self.assertEqual("Something Bad", response['error'])
def test_format_error_response(self): arguments = MockArgumentParser() client = SanicRestBotClient("sanic", arguments) self.assertIsNotNone(client) request = unittest.mock.Mock() request.raw_args = {} request.raw_args['userid'] = '1234567890' request.raw_args['question'] = 'Hello' userInfo = UserInfo(client, request) response = client.format_error_response("1234567890", "Hello", "Something Bad", userInfo) self.assertIsNotNone(response) self.assertEqual("1234567890", response['userId']) self.assertEqual("Hello", response['utterance']) self.assertEqual("", response['response']) self.assertEqual("", response['topic']) self.assertEqual("Something Bad", response['error'])