bots (minor): Simplify test_link_shortener.py further.
* Rename test names to be more descriptive. * Inline messages/response test.
This commit is contained in:
parent
e9aa94f81c
commit
d686a3b337
|
@ -7,28 +7,22 @@ class TestLinkShortenerBot(StubBotTestCase):
|
||||||
with self.mock_config_info({'key': 'qwertyuiop'}):
|
with self.mock_config_info({'key': 'qwertyuiop'}):
|
||||||
self.verify_reply(message, response)
|
self.verify_reply(message, response)
|
||||||
|
|
||||||
def test_bot(self) -> None:
|
def test_normal(self) -> None:
|
||||||
message = 'Shorten https://www.github.com/zulip/zulip please.'
|
|
||||||
response = 'https://www.github.com/zulip/zulip: https://goo.gl/6uoWKb'
|
|
||||||
|
|
||||||
with self.mock_http_conversation('test_normal'):
|
with self.mock_http_conversation('test_normal'):
|
||||||
self._test(message, response)
|
self._test('Shorten https://www.github.com/zulip/zulip please.',
|
||||||
|
'https://www.github.com/zulip/zulip: https://goo.gl/6uoWKb')
|
||||||
def test_bot_empty(self) -> None:
|
|
||||||
message = 'Shorten nothing please.'
|
|
||||||
response = 'No links found. Send "help" to see usage instructions.'
|
|
||||||
|
|
||||||
|
def test_no_links(self) -> None:
|
||||||
# No `mock_http_conversation` is necessary because the bot will
|
# No `mock_http_conversation` is necessary because the bot will
|
||||||
# recognize that no links are in the message and won't make any HTTP
|
# recognize that no links are in the message and won't make any HTTP
|
||||||
# requests.
|
# requests.
|
||||||
self._test(message, response)
|
self._test('Shorten nothing please.',
|
||||||
|
'No links found. Send "help" to see usage instructions.')
|
||||||
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.')
|
|
||||||
|
|
||||||
|
def test_help(self) -> None:
|
||||||
# No `mock_http_conversation` is necessary because the bot will
|
# No `mock_http_conversation` is necessary because the bot will
|
||||||
# recognize that the message is 'help' and won't make any HTTP
|
# recognize that the message is 'help' and won't make any HTTP
|
||||||
# requests.
|
# 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.'))
|
||||||
|
|
Loading…
Reference in a new issue