youtube bot: Replace sys.exit() with bot_handler.quit().
This commit is contained in:
parent
ff65666ac8
commit
9bf64c0c21
|
@ -39,7 +39,7 @@ class TestYoutubeBot(BotTestCase):
|
|||
|
||||
with self.mock_config_info({'key': 'somethinginvalid', 'number_of_results': '5', 'video_region': 'US'}), \
|
||||
self.mock_http_conversation('test_invalid_key'), \
|
||||
self.assertRaises(SystemExit) as se: # type: ignore
|
||||
self.assertRaises(bot_handler.BotQuitException):
|
||||
bot.initialize(bot_handler)
|
||||
|
||||
def test_multiple(self) -> None:
|
||||
|
|
|
@ -31,9 +31,8 @@ class YoutubeHandler(object):
|
|||
search_youtube('test', self.config_info['key'], self.config_info['video_region'])
|
||||
except HTTPError as e:
|
||||
if (e.response.json()['error']['errors'][0]['reason'] == 'keyInvalid'):
|
||||
logging.error('Invalid key.'
|
||||
bot_handler.quit('Invalid key.'
|
||||
'Follow the instructions in doc.md for setting API key.')
|
||||
sys.exit(1)
|
||||
else:
|
||||
raise
|
||||
except ConnectionError:
|
||||
|
|
Loading…
Reference in a new issue