From d686a3b337f952273de75397e01069c6e5dcdb0b Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Mon, 11 Dec 2017 21:32:58 -0800 Subject: [PATCH] bots (minor): Simplify test_link_shortener.py further. * Rename test names to be more descriptive. * Inline messages/response test. --- .../link_shortener/test_link_shortener.py | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/link_shortener/test_link_shortener.py b/zulip_bots/zulip_bots/bots/link_shortener/test_link_shortener.py index bec7571..314a452 100644 --- a/zulip_bots/zulip_bots/bots/link_shortener/test_link_shortener.py +++ b/zulip_bots/zulip_bots/bots/link_shortener/test_link_shortener.py @@ -7,28 +7,22 @@ class TestLinkShortenerBot(StubBotTestCase): with self.mock_config_info({'key': 'qwertyuiop'}): self.verify_reply(message, response) - def test_bot(self) -> None: - message = 'Shorten https://www.github.com/zulip/zulip please.' - response = 'https://www.github.com/zulip/zulip: https://goo.gl/6uoWKb' - + def test_normal(self) -> None: with self.mock_http_conversation('test_normal'): - self._test(message, response) - - def test_bot_empty(self) -> None: - message = 'Shorten nothing please.' - response = 'No links found. Send "help" to see usage instructions.' + self._test('Shorten https://www.github.com/zulip/zulip please.', + 'https://www.github.com/zulip/zulip: https://goo.gl/6uoWKb') + def test_no_links(self) -> None: # No `mock_http_conversation` is necessary because the bot will # recognize that no links are in the message and won't make any HTTP # requests. - self._test(message, response) - - def test_bot_help(self) -> None: - message = 'help' - response = ('Mention the link shortener bot in a conversation and then ' - 'enter any URLs you want to shorten in the body of the message.') + self._test('Shorten nothing please.', + 'No links found. Send "help" to see usage instructions.') + def test_help(self) -> None: # No `mock_http_conversation` is necessary because the bot will # recognize that the message is 'help' and won't make any HTTP # requests. - self._test(message, response) + self._test('help', + ('Mention the link shortener bot in a conversation and then ' + 'enter any URLs you want to shorten in the body of the message.'))