youtube: Add test for unknown error during initialize.

This commit is contained in:
novokrest 2018-06-08 00:23:27 +03:00 committed by showell
parent 5eef519b3b
commit f4bea72557
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,31 @@
{
"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"
}
}

View file

@ -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()