diff --git a/tools/test-bots b/tools/test-bots index de28bbb..cbd3b8c 100755 --- a/tools/test-bots +++ b/tools/test-bots @@ -98,7 +98,7 @@ def main(): for test in tests: if isinstance(test, TestCase): # Exclude test base class from being tested. - if test.__class__.__name__ not in ['StubBotTestCase', 'BotTestCase', 'BotTestCaseBase']: + if test.__class__.__name__ not in ['StubBotTestCase', 'BotTestCase']: filtered_tests.addTest(test) else: filtered_tests.addTest(filter_tests(test)) diff --git a/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py b/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py index 29a28b2..b5196b4 100755 --- a/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py +++ b/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py @@ -5,9 +5,9 @@ from __future__ import print_function import json -from zulip_bots.test_lib import BotTestCaseBase +from zulip_bots.test_lib import BotTestCase -class TestGithubDetailBot(BotTestCaseBase): +class TestGithubDetailBot(BotTestCase): bot_name = "github_detail" mock_config = {'owner': 'zulip', 'repo': 'zulip'} diff --git a/zulip_bots/zulip_bots/test_lib.py b/zulip_bots/zulip_bots/test_lib.py index f499a66..4565bdc 100755 --- a/zulip_bots/zulip_bots/test_lib.py +++ b/zulip_bots/zulip_bots/test_lib.py @@ -63,7 +63,7 @@ class StubBotHandler: class StubBotTestCase(TestCase): ''' The goal for this class is to eventually replace - BotTestCaseBase for places where we may want more + BotTestCase for places where we may want more fine-grained control and less heavy setup. ''' @@ -85,6 +85,11 @@ class StubBotTestCase(TestCase): response = bot_handler.last_test_response() self.assertEqual(expected_response, response['content']) + def test_bot_usage(self): + # type: () -> None + bot = get_bot_message_handler(self.bot_name) + self.assertNotEqual(bot.usage(), '') + def get_bot_message_handler(bot_name): # type: (str) -> Any # message_handler is of type 'Any', since it can contain any bot's @@ -134,7 +139,7 @@ def mock_http_conversation(http_data): else: mock_get.assert_called_with(http_request['api_url']) -class BotTestCaseBase(TestCase): +class BotTestCase(StubBotTestCase): """Test class for common Bot test helper methods""" bot_name = '' # type: str @@ -253,10 +258,3 @@ class BotTestCaseBase(TestCase): def assert_bot_responses(self, message, *response_list): # type: (Dict[str, Any], *Tuple[Dict[str, Any], str]) -> None self.call_request(message, *response_list) - -class BotTestCase(BotTestCaseBase): - """Test class extending BotTestCaseBase to add common default tests - that should be run (by default) for all our bots""" - def test_bot_usage(self): - # type: () -> None - self.assertNotEqual(self.message_handler.usage(), '')