mirror of
https://github.com/caronc/apprise.git
synced 2025-06-19 17:30:35 +02:00
Discord test case enhancement and code fix (dupe entry)
This commit is contained in:
parent
119b4f06e5
commit
8f87364023
@ -297,7 +297,6 @@ class NotifyTelegram(NotifyBase):
|
|||||||
'name': _('Target Chat ID'),
|
'name': _('Target Chat ID'),
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'map_to': 'targets',
|
'map_to': 'targets',
|
||||||
'map_to': 'targets',
|
|
||||||
'regex': (r'^((-?[0-9]{1,32})|([a-z_-][a-z0-9_-]+))$', 'i'),
|
'regex': (r'^((-?[0-9]{1,32})|([a-z_-][a-z0-9_-]+))$', 'i'),
|
||||||
},
|
},
|
||||||
'targets': {
|
'targets': {
|
||||||
@ -916,7 +915,7 @@ class NotifyTelegram(NotifyBase):
|
|||||||
"""
|
"""
|
||||||
Returns the number of targets associated with this notification
|
Returns the number of targets associated with this notification
|
||||||
"""
|
"""
|
||||||
return len(self.targets)
|
return 1 if not self.targets else len(self.targets)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_url(url):
|
def parse_url(url):
|
||||||
|
@ -298,14 +298,19 @@ def test_plugin_discord_notifications(mock_post):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_discord_general(mock_post):
|
@mock.patch('time.sleep')
|
||||||
|
def test_plugin_discord_general(mock_sleep, mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyDiscord() General Checks
|
NotifyDiscord() General Checks
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Prevent throttling
|
||||||
|
mock_sleep.return_value = True
|
||||||
|
|
||||||
# Turn off clock skew for local testing
|
# Turn off clock skew for local testing
|
||||||
NotifyDiscord.clock_skew = timedelta(seconds=0)
|
NotifyDiscord.clock_skew = timedelta(seconds=0)
|
||||||
|
|
||||||
# Epoch time:
|
# Epoch time:
|
||||||
epoch = datetime.fromtimestamp(0, timezone.utc)
|
epoch = datetime.fromtimestamp(0, timezone.utc)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user