added test cases

pull/1290/head
Chris Caron 2025-02-20 11:16:26 -05:00
parent 3b9b4c84b4
commit 8fdf8ee690
1 changed files with 12 additions and 0 deletions

View File

@ -445,6 +445,12 @@ def test_plugin_telegram_general(mock_post):
body='body', title='title', notify_type=NotifyType.INFO,
attach=attach) is True
# Test large messages
assert obj.notify(
body='a' * (obj.telegram_caption_maxlen + 1),
title='title', notify_type=NotifyType.INFO,
attach=attach) is True
# An invalid attachment will cause a failure
path = os.path.join(
TEST_VAR_DIR, '/invalid/path/to/an/invalid/file.jpg')
@ -453,6 +459,12 @@ def test_plugin_telegram_general(mock_post):
body='body', title='title', notify_type=NotifyType.INFO,
attach=path) is False
# Test large messages
assert obj.notify(
body='a' * (obj.telegram_caption_maxlen + 1),
title='title', notify_type=NotifyType.INFO,
attach=path) is False
obj = NotifyTelegram(bot_token=bot_token, targets=None)
# No user detected; this happens after our firsst notification
assert len(obj.targets) == 0