From 5eef519b3b57fcf8ef4abf7ca4e178a3149a6899 Mon Sep 17 00:00:00 2001 From: novokrest Date: Fri, 8 Jun 2018 21:11:13 +0300 Subject: [PATCH] giphy: Add test for connection error during config validation. --- zulip_bots/zulip_bots/bots/giphy/test_giphy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zulip_bots/zulip_bots/bots/giphy/test_giphy.py b/zulip_bots/zulip_bots/bots/giphy/test_giphy.py index 3b28b81..047cb44 100755 --- a/zulip_bots/zulip_bots/bots/giphy/test_giphy.py +++ b/zulip_bots/zulip_bots/bots/giphy/test_giphy.py @@ -39,6 +39,11 @@ class TestGiphyBot(BotTestCase, DefaultTests): self.validate_invalid_config({'key': '12345678'}, "This is likely due to an invalid key.\n") + def test_connection_error_when_validate_config(self) -> None: + error = ConnectionError() + with patch('requests.get', side_effect=ConnectionError()): + self.validate_invalid_config({'key': '12345678'}, str(error)) + def test_valid_config(self) -> None: bot = get_bot_message_handler(self.bot_name) bot_handler = StubBotHandler()