From 6087cf95e21717c7e4593ab442b9c5b76ebde533 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 30 Nov 2017 12:23:35 -0800 Subject: [PATCH] bot tests: Use StubBotTestCase in tictactoe. Note that we now only have one conversation, since the case of sending to streams has the same mechanics as sending PMs. We'll eventually want a separate test to drive out differences in the actual mechanics of the reply. --- .../bots/tictactoe/test_tictactoe.py | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py b/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py index e388d17..b98f270 100644 --- a/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py +++ b/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py @@ -1,13 +1,8 @@ #!/usr/bin/env python +from zulip_bots.test_lib import StubBotTestCase -from __future__ import absolute_import -from __future__ import print_function - -from zulip_bots.test_lib import BotTestCase -from zulip_bots.lib import StateHandler - -class TestTictactoeBot(BotTestCase): - bot_name = "tictactoe" +class TestTictactoeBot(StubBotTestCase): + bot_name = 'tictactoe' def test_bot(self): messages = [ # Template for message inputs to test, absent of message content @@ -49,7 +44,7 @@ class TestTictactoeBot(BotTestCase): "Your turn! Enter a coordinate or type help."), ) - expected_send_message = [ + conversation = [ # Empty message ("", msg['didnt_understand']), # Non-command @@ -89,8 +84,5 @@ class TestTictactoeBot(BotTestCase): ("quit", msg['successful_quit']), # Can't test 'after_3_2' as it's random! ] - for m in messages: - for (mesg, resp) in expected_send_message: - self.assert_bot_response(dict(m, content=mesg), - dict(private_response, content=resp), - 'send_message') + + self.verify_dialog(conversation)