Previously the test-bots script filtered out base-class tests from BotTestCase. With this change, BotTestCase continues to inherit from unittest.TestCase, but the default test_* methods previously in this class are now in a new DefaultTests class, which does not. Instead, each bot needs to inherit from BotTestCase and DefaultTests *explicitly*. This avoids the need to filter out the base-class tests, which simplifies the test-bots script, and may ease any migration to eg. pytest. The DefaultTests class does require some non-implemented methods which BotTestCase provides.
28 lines
714 B
Python
28 lines
714 B
Python
"""
|
|
Most of the testing for the actual game are done in test_database
|
|
|
|
This is only to really verify the output of the chat
|
|
"""
|
|
|
|
from unittest import mock
|
|
|
|
import zulip_bots.bots.merels.merels
|
|
import zulip_bots.test_lib
|
|
|
|
|
|
class TestFollowUpBot(zulip_bots.test_lib.BotTestCase, DefaultTests):
|
|
bot_name = "merels"
|
|
|
|
def test_no_command(self):
|
|
message = dict(
|
|
content='magic',
|
|
type='stream',
|
|
sender_email="boo@email.com",
|
|
sender_full_name="boo"
|
|
)
|
|
|
|
res = self.get_response(message)
|
|
|
|
self.assertEqual(res['content'],
|
|
'You are not in a game at the moment.'
|
|
' Type `help` for help.')
|