diff --git a/tools/run-mypy b/tools/run-mypy index fceb4fc..0e24d07 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -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", diff --git a/zulip_bots/zulip_bots/bots/googlesearch/__init__.py b/zulip_bots/zulip_bots/bots/google_search/__init__.py similarity index 100% rename from zulip_bots/zulip_bots/bots/googlesearch/__init__.py rename to zulip_bots/zulip_bots/bots/google_search/__init__.py diff --git a/zulip_bots/zulip_bots/bots/googlesearch/doc.md b/zulip_bots/zulip_bots/bots/google_search/doc.md similarity index 100% rename from zulip_bots/zulip_bots/bots/googlesearch/doc.md rename to zulip_bots/zulip_bots/bots/google_search/doc.md diff --git a/zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_attribute_error.json b/zulip_bots/zulip_bots/bots/google_search/fixtures/test_attribute_error.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_attribute_error.json rename to zulip_bots/zulip_bots/bots/google_search/fixtures/test_attribute_error.json diff --git a/zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_ignore_links.json b/zulip_bots/zulip_bots/bots/google_search/fixtures/test_ignore_links.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_ignore_links.json rename to zulip_bots/zulip_bots/bots/google_search/fixtures/test_ignore_links.json diff --git a/zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_no_result.json b/zulip_bots/zulip_bots/bots/google_search/fixtures/test_no_result.json similarity index 95% rename from zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_no_result.json rename to zulip_bots/zulip_bots/bots/google_search/fixtures/test_no_result.json index d604afc..f3355af 100644 --- a/zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_no_result.json +++ b/zulip_bots/zulip_bots/bots/google_search/fixtures/test_no_result.json @@ -1,13 +1,13 @@ -{ - "request": { - "api_url": "http://www.google.com/search", - "params": { - "q": "no res" - } - }, - "response": "", - "response-headers": { - "status": 200, - "content-type": "text/html; charset=utf-8" - } - } +{ + "request": { + "api_url": "http://www.google.com/search", + "params": { + "q": "no res" + } + }, + "response": "", + "response-headers": { + "status": 200, + "content-type": "text/html; charset=utf-8" + } + } diff --git a/zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_normal.json b/zulip_bots/zulip_bots/bots/google_search/fixtures/test_normal.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googlesearch/fixtures/test_normal.json rename to zulip_bots/zulip_bots/bots/google_search/fixtures/test_normal.json diff --git a/zulip_bots/zulip_bots/bots/googlesearch/googlesearch.py b/zulip_bots/zulip_bots/bots/google_search/google_search.py similarity index 100% rename from zulip_bots/zulip_bots/bots/googlesearch/googlesearch.py rename to zulip_bots/zulip_bots/bots/google_search/google_search.py diff --git a/zulip_bots/zulip_bots/bots/googlesearch/logo.png b/zulip_bots/zulip_bots/bots/google_search/logo.png similarity index 100% rename from zulip_bots/zulip_bots/bots/googlesearch/logo.png rename to zulip_bots/zulip_bots/bots/google_search/logo.png diff --git a/zulip_bots/zulip_bots/bots/googlesearch/test_googlesearch.py b/zulip_bots/zulip_bots/bots/google_search/test_google_search.py similarity index 98% rename from zulip_bots/zulip_bots/bots/googlesearch/test_googlesearch.py rename to zulip_bots/zulip_bots/bots/google_search/test_google_search.py index 81cb4ae..da3caec 100644 --- a/zulip_bots/zulip_bots/bots/googlesearch/test_googlesearch.py +++ b/zulip_bots/zulip_bots/bots/google_search/test_google_search.py @@ -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: diff --git a/zulip_bots/zulip_bots/bots/googletranslate/__init__.py b/zulip_bots/zulip_bots/bots/google_translate/__init__.py similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/__init__.py rename to zulip_bots/zulip_bots/bots/google_translate/__init__.py diff --git a/zulip_bots/zulip_bots/bots/googletranslate/doc.md b/zulip_bots/zulip_bots/bots/google_translate/doc.md similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/doc.md rename to zulip_bots/zulip_bots/bots/google_translate/doc.md diff --git a/zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_403.json b/zulip_bots/zulip_bots/bots/google_translate/fixtures/test_403.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_403.json rename to zulip_bots/zulip_bots/bots/google_translate/fixtures/test_403.json diff --git a/zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_conn_error.json b/zulip_bots/zulip_bots/bots/google_translate/fixtures/test_conn_error.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_conn_error.json rename to zulip_bots/zulip_bots/bots/google_translate/fixtures/test_conn_error.json diff --git a/zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_language_403.json b/zulip_bots/zulip_bots/bots/google_translate/fixtures/test_language_403.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_language_403.json rename to zulip_bots/zulip_bots/bots/google_translate/fixtures/test_language_403.json diff --git a/zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_languages.json b/zulip_bots/zulip_bots/bots/google_translate/fixtures/test_languages.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_languages.json rename to zulip_bots/zulip_bots/bots/google_translate/fixtures/test_languages.json diff --git a/zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_normal.json b/zulip_bots/zulip_bots/bots/google_translate/fixtures/test_normal.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_normal.json rename to zulip_bots/zulip_bots/bots/google_translate/fixtures/test_normal.json diff --git a/zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_quotation.json b/zulip_bots/zulip_bots/bots/google_translate/fixtures/test_quotation.json similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/fixtures/test_quotation.json rename to zulip_bots/zulip_bots/bots/google_translate/fixtures/test_quotation.json diff --git a/zulip_bots/zulip_bots/bots/googletranslate/googletranslate.conf b/zulip_bots/zulip_bots/bots/google_translate/google_translate.conf similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/googletranslate.conf rename to zulip_bots/zulip_bots/bots/google_translate/google_translate.conf diff --git a/zulip_bots/zulip_bots/bots/googletranslate/googletranslate.py b/zulip_bots/zulip_bots/bots/google_translate/google_translate.py similarity index 100% rename from zulip_bots/zulip_bots/bots/googletranslate/googletranslate.py rename to zulip_bots/zulip_bots/bots/google_translate/google_translate.py diff --git a/zulip_bots/zulip_bots/bots/googletranslate/test_googletranslate.py b/zulip_bots/zulip_bots/bots/google_translate/test_google_translate.py similarity index 94% rename from zulip_bots/zulip_bots/bots/googletranslate/test_googletranslate.py rename to zulip_bots/zulip_bots/bots/google_translate/test_google_translate.py index 9b92f31..e6d928a 100644 --- a/zulip_bots/zulip_bots/bots/googletranslate/test_googletranslate.py +++ b/zulip_bots/zulip_bots/bots/google_translate/test_google_translate.py @@ -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')