bot tests: Extract get_reply_dict() test helper.

This commit is contained in:
Steve Howell 2018-01-10 11:36:05 -05:00 committed by showell
parent 4458276801
commit 917bd82019

View file

@ -120,13 +120,18 @@ class BotTestCase(TestCase):
) )
return message return message
def verify_reply(self, request, response): def get_reply_dict(self, request):
# type: (str, str) -> None # type: (str) -> Dict[str, Any]
bot, bot_handler = self._get_handlers() bot, bot_handler = self._get_handlers()
message = self.make_request_message(request) message = self.make_request_message(request)
bot_handler.reset_transcript() bot_handler.reset_transcript()
bot.handle_message(message, bot_handler) bot.handle_message(message, bot_handler)
reply = bot_handler.unique_reply() reply = bot_handler.unique_reply()
return reply
def verify_reply(self, request, response):
# type: (str, str) -> None
reply = self.get_reply_dict(request)
self.assertEqual(response, reply['content']) self.assertEqual(response, reply['content'])
def verify_dialog(self, conversation): def verify_dialog(self, conversation):