add _ to googletranslate and googlesearch
This commit is contained in:
parent
657c6d7b9c
commit
424a4bb631
|
@ -43,8 +43,8 @@ force_include = [
|
|||
"zulip_bots/zulip_bots/bots/giphy/test_giphy.py",
|
||||
"zulip_bots/zulip_bots/bots/github_detail/github_detail.py",
|
||||
"zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py",
|
||||
"zulip_bots/zulip_bots/bots/googlesearch/googlesearch.py",
|
||||
"zulip_bots/zulip_bots/bots/googlesearch/test_googlesearch.py",
|
||||
"zulip_bots/zulip_bots/bots/google_search/google_search.py",
|
||||
"zulip_bots/zulip_bots/bots/google_search/test_google_search.py",
|
||||
"zulip_bots/zulip_bots/bots/help/help.py",
|
||||
"zulip_bots/zulip_bots/bots/help/test_help.py",
|
||||
"zulip_bots/zulip_bots/bots/incrementor/incrementor.py",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"request": {
|
||||
"api_url": "http://www.google.com/search",
|
||||
"params": {
|
||||
"q": "no res"
|
||||
}
|
||||
},
|
||||
"response": "<head></head><body><div id='search'></div></body>",
|
||||
"response-headers": {
|
||||
"status": 200,
|
||||
"content-type": "text/html; charset=utf-8"
|
||||
}
|
||||
}
|
||||
{
|
||||
"request": {
|
||||
"api_url": "http://www.google.com/search",
|
||||
"params": {
|
||||
"q": "no res"
|
||||
}
|
||||
},
|
||||
"response": "<head></head><body><div id='search'></div></body>",
|
||||
"response-headers": {
|
||||
"status": 200,
|
||||
"content-type": "text/html; charset=utf-8"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
@ -5,7 +5,7 @@ from zulip_bots.test_lib import StubBotTestCase
|
|||
from unittest.mock import patch
|
||||
|
||||
class TestGoogleSearchBot(StubBotTestCase):
|
||||
bot_name = 'googlesearch'
|
||||
bot_name = 'google_search'
|
||||
|
||||
# Simple query
|
||||
def test_normal(self) -> None:
|
|
@ -2,7 +2,7 @@ from unittest.mock import patch
|
|||
from requests.exceptions import ConnectionError
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
from zulip_bots.bots.googletranslate.googletranslate import TranslateError
|
||||
from zulip_bots.bots.google_translate.google_translate import TranslateError
|
||||
|
||||
help_text = '''
|
||||
Google translate bot
|
||||
|
@ -12,7 +12,7 @@ Visit [here](https://cloud.google.com/translate/docs/languages) for all language
|
|||
'''
|
||||
|
||||
class TestGoogleTranslateBot(StubBotTestCase):
|
||||
bot_name = "googletranslate"
|
||||
bot_name = "google_translate"
|
||||
|
||||
def _test(self, message, response, http_config_fixture, http_fixture=None):
|
||||
with self.mock_config_info({'key': 'abcdefg'}), \
|
||||
|
@ -62,7 +62,7 @@ class TestGoogleTranslateBot(StubBotTestCase):
|
|||
'test_languages', 'test_quotation')
|
||||
|
||||
def test_exception(self):
|
||||
with patch('zulip_bots.bots.googletranslate.googletranslate.translate',
|
||||
with patch('zulip_bots.bots.google_translate.google_translate.translate',
|
||||
side_effect=Exception):
|
||||
self._test('"hello" de', 'Error. .', 'test_languages')
|
||||
|
Loading…
Reference in a new issue