catch TelegramError (fixes #113)

This commit is contained in:
gcarq
2017-11-17 19:47:29 +01:00
parent 77887d6fbc
commit 59d04d1d0c
2 changed files with 15 additions and 12 deletions

View File

@@ -535,8 +535,7 @@ def test_send_msg_network_error(default_conf, mocker):
default_conf['telegram']['enabled'] = True
bot = MagicMock()
bot.send_message = MagicMock(side_effect=NetworkError('Oh snap'))
with pytest.raises(NetworkError, match=r'Oh snap'):
send_msg('test', bot)
send_msg('test', bot)
# Bot should've tried to send it twice
assert len(bot.method_calls) == 2