python-zulip-api/zulip_bots/zulip_bots/bots/googlesearch/test_googlesearch.py
Steve Howell 6f0d5239e8 test_googlesearch: Remove self: Any annotations.
We can avoid `Any` annotations for `self`, since it is more
noise than signal and since the type of self is already
implicit from how Python classes work.
2017-12-07 19:40:32 -08:00

31 lines
1.1 KiB
Python

#!/usr/bin/env python
from zulip_bots.test_lib import StubBotTestCase
class TestGoogleSearchBot(StubBotTestCase):
bot_name = 'googlesearch'
# Simple query
def test_normal(self) -> None:
with self.mock_http_conversation('test_normal'):
self.verify_reply(
'zulip',
'Found Result: [Zulip](https://www.google.com/url?url=https%3A%2F%2Fzulipchat.com%2F)'
)
def test_bot_help(self) -> None:
help_message = "To use this bot, start messages with @mentioned-bot, \
followed by what you want to search for. If \
found, Zulip will return the first search result \
on Google.\
\
An example message that could be sent is:\
'@mentioned-bot zulip' or \
'@mentioned-bot how to create a chatbot'."
self.verify_reply('', help_message)
self.verify_reply('help', help_message)
def test_bot_no_results(self) -> None:
with self.mock_http_conversation('test_no_result'):
self.verify_reply('no res', 'Found no results.')