diff --git a/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py b/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py index bda2dd2..0824125 100755 --- a/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py +++ b/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py @@ -59,12 +59,13 @@ class TestWikipediaBot(StubBotTestCase): # Incorrect status code bot_request = 'Zulip' - bot_response = None + bot_response = 'Uh-Oh ! Sorry ,couldn\'t process the request right now.:slightly_frowning_face:\n' \ + 'Please try again later.' + with self.mock_http_conversation('test_status_code'): self.verify_reply(bot_request, bot_response) # Request Exception bot_request = 'Z' - bot_response = None with mock_request_exception(): self.verify_reply(bot_request, bot_response) diff --git a/zulip_bots/zulip_bots/bots/wikipedia/wikipedia.py b/zulip_bots/zulip_bots/bots/wikipedia/wikipedia.py index b74fb38..5373639 100644 --- a/zulip_bots/zulip_bots/bots/wikipedia/wikipedia.py +++ b/zulip_bots/zulip_bots/bots/wikipedia/wikipedia.py @@ -56,12 +56,15 @@ class WikipediaHandler(object): except requests.exceptions.RequestException: logging.error('broken link') - return None + return 'Uh-Oh ! Sorry ,couldn\'t process the request right now.:slightly_frowning_face:\n' \ + 'Please try again later.' # Checking if the bot accessed the link. if data.status_code != 200: logging.error('Page not found.') - return None + return 'Uh-Oh ! Sorry ,couldn\'t process the request right now.:slightly_frowning_face:\n' \ + 'Please try again later.' + new_content = 'For search term:' + query + '\n' # Checking if there is content for the searched term