youtube: Add test for unknown error during initialize
.
This commit is contained in:
parent
5eef519b3b
commit
f4bea72557
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue