python-zulip-api/zulip_bots/zulip_bots/bots/help/test_help.py
neiljp (Neil Pilgrim) 6cdb83ce72 bot tests: Adjust TestCase inheritance to avoid need to skip/filter.
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.
2018-06-09 12:49:49 -04:00

18 lines
460 B
Python
Executable file

from zulip_bots.test_lib import BotTestCase, DefaultTests
from typing import Any
class TestHelpBot(BotTestCase, DefaultTests):
bot_name = "help"
def test_bot(self) -> None:
help_text = "Info on Zulip can be found here:\nhttps://github.com/zulip/zulip"
requests = ["", "help", "Hi, my name is abc"]
dialog = [
(request, help_text)
for request in requests
]
self.verify_dialog(dialog)