mirror of
https://github.com/caronc/apprise-api.git
synced 2025-08-24 12:45:22 +02:00
Support for Apprise v1.7.1 (#159)
This commit is contained in:
@@ -31,6 +31,9 @@ import json
|
||||
import apprise
|
||||
from inspect import cleandoc
|
||||
|
||||
# Grant access to our Notification Manager Singleton
|
||||
N_MGR = apprise.NotificationManager.NotificationManager()
|
||||
|
||||
|
||||
class NotifyTests(SimpleTestCase):
|
||||
"""
|
||||
@@ -247,7 +250,7 @@ class NotifyTests(SimpleTestCase):
|
||||
# Disable Throttling to speed testing
|
||||
apprise.plugins.NotifyBase.request_rate_per_sec = 0
|
||||
# Ensure we're enabled for the purpose of our testing
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled = True
|
||||
N_MGR['json'].enabled = True
|
||||
|
||||
# Prepare our response
|
||||
response = requests.Request()
|
||||
@@ -339,7 +342,7 @@ class NotifyTests(SimpleTestCase):
|
||||
# Disable Throttling to speed testing
|
||||
apprise.plugins.NotifyBase.request_rate_per_sec = 0
|
||||
# Ensure we're enabled for the purpose of our testing
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled = True
|
||||
N_MGR['json'].enabled = True
|
||||
|
||||
# Prepare our response
|
||||
response = requests.Request()
|
||||
@@ -441,7 +444,7 @@ class NotifyTests(SimpleTestCase):
|
||||
# Disable Throttling to speed testing
|
||||
apprise.plugins.NotifyBase.request_rate_per_sec = 0
|
||||
# Ensure we're enabled for the purpose of our testing
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled = True
|
||||
N_MGR['json'].enabled = True
|
||||
|
||||
# Prepare our response
|
||||
response = requests.Request()
|
||||
@@ -931,7 +934,7 @@ class NotifyTests(SimpleTestCase):
|
||||
}
|
||||
|
||||
# Verify by default email is enabled
|
||||
assert apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||
assert N_MGR['mailto'].enabled is True
|
||||
|
||||
# Send our service with the `mailto://` denied
|
||||
with override_settings(APPRISE_ALLOW_SERVICES=""):
|
||||
@@ -948,11 +951,10 @@ class NotifyTests(SimpleTestCase):
|
||||
assert mock_send.call_count == 0
|
||||
|
||||
# What actually took place behind close doors:
|
||||
assert \
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is False
|
||||
assert N_MGR['mailto'].enabled is False
|
||||
|
||||
# Reset our flag (for next test)
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled = True
|
||||
N_MGR['mailto'].enabled = True
|
||||
|
||||
# Reset Mock
|
||||
mock_send.reset_mock()
|
||||
@@ -972,8 +974,7 @@ class NotifyTests(SimpleTestCase):
|
||||
assert mock_send.call_count == 1
|
||||
|
||||
# Verify that mailto was never turned off
|
||||
assert \
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||
assert N_MGR['mailto'].enabled is True
|
||||
|
||||
# Reset Mock
|
||||
mock_send.reset_mock()
|
||||
@@ -993,8 +994,7 @@ class NotifyTests(SimpleTestCase):
|
||||
assert mock_send.call_count == 1
|
||||
|
||||
# Verify email was never turned off
|
||||
assert \
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||
assert N_MGR['mailto'].enabled is True
|
||||
|
||||
# Reset Mock
|
||||
mock_send.reset_mock()
|
||||
@@ -1014,8 +1014,7 @@ class NotifyTests(SimpleTestCase):
|
||||
assert mock_send.call_count == 1
|
||||
|
||||
# Verify email was never turned off
|
||||
assert \
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||
assert N_MGR['mailto'].enabled is True
|
||||
|
||||
# Reset Mock
|
||||
mock_send.reset_mock()
|
||||
@@ -1035,12 +1034,10 @@ class NotifyTests(SimpleTestCase):
|
||||
assert mock_send.call_count == 0
|
||||
|
||||
# What actually took place behind close doors:
|
||||
assert \
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto']\
|
||||
.enabled is False
|
||||
assert N_MGR['mailto'].enabled is False
|
||||
|
||||
# Reset our flag (for next test)
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled = True
|
||||
N_MGR['mailto'].enabled = True
|
||||
|
||||
# Reset Mock
|
||||
mock_send.reset_mock()
|
||||
@@ -1060,8 +1057,7 @@ class NotifyTests(SimpleTestCase):
|
||||
assert mock_send.call_count == 1
|
||||
|
||||
# nothing was changed
|
||||
assert \
|
||||
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||
assert N_MGR['mailto'].enabled is True
|
||||
|
||||
@override_settings(APPRISE_RECURSION_MAX=1)
|
||||
@mock.patch('apprise.Apprise.notify')
|
||||
|
Reference in New Issue
Block a user