youtube: Add test for unknown error during `initialize`.
ADD
zulip_bots/zulip_bots/bots/youtube/fixtures/test_unknown_error.json
+{
+ "request": {
+ "api_url": "https://www.googleapis.com/youtube/v3/search",
+ "params": {
+ "part": "id,snippet",
+ "maxResults": 1,
+ "key": "12345678",
+ "q": "test",
+ "alt": "json",
+ "type": "video",
+ "regionCode": "US"
+ }
+ },
+ "response": {
+ "error": {
+ "errors": [
+ {
+ "domain": "error",
+ "reason": "unknownError",
+ "message": "Unknown Rrror"
+ }
+ ],
+ "code": 400,
+ "message": "Bad Request"
+ }
+ },
+ "response-headers": {
+ "status": 400,
+ "content-type": "application/json; charset=utf-8"
+ }
+ }

MODIFY
zulip_bots/zulip_bots/bots/youtube/test_youtube.py
zulip_bots/zulip_bots/bots/youtube/test_youtube.py
@@ -43,6 +43,15 @@ class TestYoutubeBot(BotTestCase, DefaultTests):
self.assertRaises(bot_handler.BotQuitException):
bot.initialize(bot_handler)
+ def test_unknown_error(self) -> None:
+ bot = get_bot_message_handler(self.bot_name)
+ bot_handler = StubBotHandler()
+
+ with self.mock_config_info(self.normal_config), \
+ self.mock_http_conversation('test_unknown_error'), \
+ self.assertRaises(HTTPError):
+ bot.initialize(bot_handler)
+
def test_multiple(self) -> None:
bot = get_bot_message_handler(self.bot_name)
bot_handler = StubBotHandler()

youtube: Add test for unknown error during `initialize`.