mirror of
https://github.com/caronc/apprise.git
synced 2025-03-15 15:28:47 +01:00
added test cases
This commit is contained in:
parent
3b9b4c84b4
commit
8fdf8ee690
@ -445,6 +445,12 @@ def test_plugin_telegram_general(mock_post):
|
|||||||
body='body', title='title', notify_type=NotifyType.INFO,
|
body='body', title='title', notify_type=NotifyType.INFO,
|
||||||
attach=attach) is True
|
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
|
# An invalid attachment will cause a failure
|
||||||
path = os.path.join(
|
path = os.path.join(
|
||||||
TEST_VAR_DIR, '/invalid/path/to/an/invalid/file.jpg')
|
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,
|
body='body', title='title', notify_type=NotifyType.INFO,
|
||||||
attach=path) is False
|
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)
|
obj = NotifyTelegram(bot_token=bot_token, targets=None)
|
||||||
# No user detected; this happens after our firsst notification
|
# No user detected; this happens after our firsst notification
|
||||||
assert len(obj.targets) == 0
|
assert len(obj.targets) == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user