mirror of
https://github.com/caronc/apprise-api.git
synced 2025-08-13 16:37:01 +02:00
updated SCHEMA MAP property to reflect changes in Apprise v1.0 (#90)
This commit is contained in:
@ -83,7 +83,7 @@ class NotifyTests(SimpleTestCase):
|
|||||||
# Disable Throttling to speed testing
|
# Disable Throttling to speed testing
|
||||||
apprise.plugins.NotifyBase.request_rate_per_sec = 0
|
apprise.plugins.NotifyBase.request_rate_per_sec = 0
|
||||||
# Ensure we're enabled for the purpose of our testing
|
# Ensure we're enabled for the purpose of our testing
|
||||||
apprise.plugins.SCHEMA_MAP['json'].enabled = True
|
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled = True
|
||||||
|
|
||||||
# Prepare our response
|
# Prepare our response
|
||||||
response = requests.Request()
|
response = requests.Request()
|
||||||
@ -461,7 +461,7 @@ class NotifyTests(SimpleTestCase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Verify by default email is enabled
|
# Verify by default email is enabled
|
||||||
assert apprise.plugins.SCHEMA_MAP['mailto'].enabled is True
|
assert apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||||
|
|
||||||
# Send our service with the `mailto://` denied
|
# Send our service with the `mailto://` denied
|
||||||
with override_settings(APPRISE_ALLOW_SERVICES=""):
|
with override_settings(APPRISE_ALLOW_SERVICES=""):
|
||||||
@ -478,10 +478,11 @@ class NotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 0
|
assert mock_send.call_count == 0
|
||||||
|
|
||||||
# What actually took place behind close doors:
|
# What actually took place behind close doors:
|
||||||
assert apprise.plugins.SCHEMA_MAP['mailto'].enabled is False
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is False
|
||||||
|
|
||||||
# Reset our flag (for next test)
|
# Reset our flag (for next test)
|
||||||
apprise.plugins.SCHEMA_MAP['mailto'].enabled = True
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled = True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -501,7 +502,8 @@ class NotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# Verify that mailto was never turned off
|
# Verify that mailto was never turned off
|
||||||
assert apprise.plugins.SCHEMA_MAP['mailto'].enabled is True
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -521,7 +523,8 @@ class NotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# Verify email was never turned off
|
# Verify email was never turned off
|
||||||
assert apprise.plugins.SCHEMA_MAP['mailto'].enabled is True
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -541,7 +544,8 @@ class NotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# Verify email was never turned off
|
# Verify email was never turned off
|
||||||
assert apprise.plugins.SCHEMA_MAP['mailto'].enabled is True
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -561,10 +565,12 @@ class NotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 0
|
assert mock_send.call_count == 0
|
||||||
|
|
||||||
# What actually took place behind close doors:
|
# What actually took place behind close doors:
|
||||||
assert apprise.plugins.SCHEMA_MAP['mailto'].enabled is False
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto']\
|
||||||
|
.enabled is False
|
||||||
|
|
||||||
# Reset our flag (for next test)
|
# Reset our flag (for next test)
|
||||||
apprise.plugins.SCHEMA_MAP['mailto'].enabled = True
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled = True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -584,7 +590,8 @@ class NotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# nothing was changed
|
# nothing was changed
|
||||||
assert apprise.plugins.SCHEMA_MAP['mailto'].enabled is True
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled is True
|
||||||
|
|
||||||
@override_settings(APPRISE_RECURSION_MAX=1)
|
@override_settings(APPRISE_RECURSION_MAX=1)
|
||||||
@patch('apprise.Apprise.notify')
|
@patch('apprise.Apprise.notify')
|
||||||
|
@ -90,7 +90,7 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Ensure we're enabled for the purpose of our testing
|
# Ensure we're enabled for the purpose of our testing
|
||||||
apprise.plugins.SCHEMA_MAP['mailto'].enabled = True
|
apprise.common.NOTIFY_SCHEMA_MAP['mailto'].enabled = True
|
||||||
|
|
||||||
# Set our return value; first we return a true, then we fail
|
# Set our return value; first we return a true, then we fail
|
||||||
# on the second call
|
# on the second call
|
||||||
@ -364,7 +364,7 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Ensure we're enabled for the purpose of our testing
|
# Ensure we're enabled for the purpose of our testing
|
||||||
apprise.plugins.SCHEMA_MAP['json'].enabled = True
|
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled = True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -384,10 +384,11 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 0
|
assert mock_send.call_count == 0
|
||||||
|
|
||||||
# What actually took place behind close doors:
|
# What actually took place behind close doors:
|
||||||
assert apprise.plugins.SCHEMA_MAP['json'].enabled is False
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled is False
|
||||||
|
|
||||||
# Reset our flag (for next test)
|
# Reset our flag (for next test)
|
||||||
apprise.plugins.SCHEMA_MAP['json'].enabled = True
|
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled = True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -407,7 +408,7 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# Verify that json was never turned off
|
# Verify that json was never turned off
|
||||||
assert apprise.plugins.SCHEMA_MAP['json'].enabled is True
|
assert apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled is True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -427,7 +428,7 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# Verify email was never turned off
|
# Verify email was never turned off
|
||||||
assert apprise.plugins.SCHEMA_MAP['json'].enabled is True
|
assert apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled is True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -447,7 +448,7 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# Verify email was never turned off
|
# Verify email was never turned off
|
||||||
assert apprise.plugins.SCHEMA_MAP['json'].enabled is True
|
assert apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled is True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -467,10 +468,11 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 0
|
assert mock_send.call_count == 0
|
||||||
|
|
||||||
# What actually took place behind close doors:
|
# What actually took place behind close doors:
|
||||||
assert apprise.plugins.SCHEMA_MAP['json'].enabled is False
|
assert \
|
||||||
|
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled is False
|
||||||
|
|
||||||
# Reset our flag (for next test)
|
# Reset our flag (for next test)
|
||||||
apprise.plugins.SCHEMA_MAP['json'].enabled = True
|
apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled = True
|
||||||
|
|
||||||
# Reset Mock
|
# Reset Mock
|
||||||
mock_send.reset_mock()
|
mock_send.reset_mock()
|
||||||
@ -490,4 +492,4 @@ class StatelessNotifyTests(SimpleTestCase):
|
|||||||
assert mock_send.call_count == 1
|
assert mock_send.call_count == 1
|
||||||
|
|
||||||
# nothing was changed
|
# nothing was changed
|
||||||
assert apprise.plugins.SCHEMA_MAP['json'].enabled is True
|
assert apprise.common.NOTIFY_SCHEMA_MAP['json'].enabled is True
|
||||||
|
@ -607,7 +607,7 @@ class NotifyView(View):
|
|||||||
for x in re.split(r'[ ,]+', settings.APPRISE_ALLOW_SERVICES)
|
for x in re.split(r'[ ,]+', settings.APPRISE_ALLOW_SERVICES)
|
||||||
if alphanum_re.match(x)]
|
if alphanum_re.match(x)]
|
||||||
|
|
||||||
for plugin in set(apprise.plugins.SCHEMA_MAP.values()):
|
for plugin in set(apprise.common.NOTIFY_SCHEMA_MAP.values()):
|
||||||
if entries:
|
if entries:
|
||||||
# Get a list of the current schema's associated with
|
# Get a list of the current schema's associated with
|
||||||
# a given plugin
|
# a given plugin
|
||||||
@ -646,7 +646,7 @@ class NotifyView(View):
|
|||||||
for name in entries:
|
for name in entries:
|
||||||
try:
|
try:
|
||||||
# Force plugin to be disabled
|
# Force plugin to be disabled
|
||||||
apprise.plugins.SCHEMA_MAP[name].enabled = False
|
apprise.common.NOTIFY_SCHEMA_MAP[name].enabled = False
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
@ -900,7 +900,7 @@ class StatelessNotifyView(View):
|
|||||||
for x in re.split(r'[ ,]+', settings.APPRISE_ALLOW_SERVICES)
|
for x in re.split(r'[ ,]+', settings.APPRISE_ALLOW_SERVICES)
|
||||||
if alphanum_re.match(x)]
|
if alphanum_re.match(x)]
|
||||||
|
|
||||||
for plugin in set(apprise.plugins.SCHEMA_MAP.values()):
|
for plugin in set(apprise.common.NOTIFY_SCHEMA_MAP.values()):
|
||||||
if entries:
|
if entries:
|
||||||
# Get a list of the current schema's associated with
|
# Get a list of the current schema's associated with
|
||||||
# a given plugin
|
# a given plugin
|
||||||
@ -939,7 +939,7 @@ class StatelessNotifyView(View):
|
|||||||
for name in entries:
|
for name in entries:
|
||||||
try:
|
try:
|
||||||
# Force plugin to be disabled
|
# Force plugin to be disabled
|
||||||
apprise.plugins.SCHEMA_MAP[name].enabled = False
|
apprise.common.NOTIFY_SCHEMA_MAP[name].enabled = False
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
|
Reference in New Issue
Block a user