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.
This commit is contained in:
parent
77dbe92ad8
commit
6087cf95e2
|
@ -1,13 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
from zulip_bots.test_lib import StubBotTestCase
|
||||||
|
|
||||||
from __future__ import absolute_import
|
class TestTictactoeBot(StubBotTestCase):
|
||||||
from __future__ import print_function
|
bot_name = 'tictactoe'
|
||||||
|
|
||||||
from zulip_bots.test_lib import BotTestCase
|
|
||||||
from zulip_bots.lib import StateHandler
|
|
||||||
|
|
||||||
class TestTictactoeBot(BotTestCase):
|
|
||||||
bot_name = "tictactoe"
|
|
||||||
|
|
||||||
def test_bot(self):
|
def test_bot(self):
|
||||||
messages = [ # Template for message inputs to test, absent of message content
|
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."),
|
"Your turn! Enter a coordinate or type help."),
|
||||||
)
|
)
|
||||||
|
|
||||||
expected_send_message = [
|
conversation = [
|
||||||
# Empty message
|
# Empty message
|
||||||
("", msg['didnt_understand']),
|
("", msg['didnt_understand']),
|
||||||
# Non-command
|
# Non-command
|
||||||
|
@ -89,8 +84,5 @@ class TestTictactoeBot(BotTestCase):
|
||||||
("quit", msg['successful_quit']),
|
("quit", msg['successful_quit']),
|
||||||
# Can't test 'after_3_2' as it's random!
|
# Can't test 'after_3_2' as it's random!
|
||||||
]
|
]
|
||||||
for m in messages:
|
|
||||||
for (mesg, resp) in expected_send_message:
|
self.verify_dialog(conversation)
|
||||||
self.assert_bot_response(dict(m, content=mesg),
|
|
||||||
dict(private_response, content=resp),
|
|
||||||
'send_message')
|
|
||||||
|
|
Loading…
Reference in a new issue