mirror of
https://github.com/caronc/apprise.git
synced 2025-01-01 03:29:53 +01:00
Tests: Use global no_throttling_everywhere
fixture (#701)
Instead of needing to individually disable throttling on a per-plugin basis, this fixture takes care of all notifiers in `NOTIFY_MODULE_MAP` automatically. With `autouse=True`, there is no need to activate it manually.
This commit is contained in:
parent
ed876d1ca2
commit
c81d2465e4
@ -1,3 +1,7 @@
|
|||||||
|
import types
|
||||||
|
import typing as t
|
||||||
|
|
||||||
|
|
||||||
class NotifyType:
|
class NotifyType:
|
||||||
INFO: NotifyType
|
INFO: NotifyType
|
||||||
SUCCESS: NotifyType
|
SUCCESS: NotifyType
|
||||||
@ -12,4 +16,7 @@ class NotifyFormat:
|
|||||||
class ContentLocation:
|
class ContentLocation:
|
||||||
LOCAL: ContentLocation
|
LOCAL: ContentLocation
|
||||||
HOSTED: ContentLocation
|
HOSTED: ContentLocation
|
||||||
INACCESSIBLE: ContentLocation
|
INACCESSIBLE: ContentLocation
|
||||||
|
|
||||||
|
|
||||||
|
NOTIFY_MODULE_MAP: t.Dict[str, t.Dict[str, t.Union[t.Type["NotifyBase"], types.ModuleType]]]
|
||||||
|
@ -2,6 +2,7 @@ coverage
|
|||||||
flake8
|
flake8
|
||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
|
pytest-mock
|
||||||
pytest-xdist
|
pytest-xdist
|
||||||
tox
|
tox
|
||||||
babel
|
babel
|
||||||
|
@ -27,22 +27,17 @@ import os
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from apprise import NotifyBase
|
from apprise.common import NOTIFY_MODULE_MAP
|
||||||
from apprise.plugins.NotifyPushBullet import NotifyPushBullet
|
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
def no_throttling():
|
def no_throttling_everywhere(session_mocker):
|
||||||
"""
|
"""
|
||||||
A pytest fixture which disables Apprise throttling.
|
A pytest session fixture which disables throttling on all notifiers.
|
||||||
|
It is automatically enabled.
|
||||||
"""
|
"""
|
||||||
backup = {}
|
for notifier in NOTIFY_MODULE_MAP.values():
|
||||||
backup["NotifyBase"] = NotifyBase.request_rate_per_sec
|
plugin = notifier["plugin"]
|
||||||
backup["NotifyPushBullet"] = NotifyPushBullet.request_rate_per_sec
|
session_mocker.patch.object(plugin, "request_rate_per_sec", 0)
|
||||||
NotifyBase.request_rate_per_sec = 0
|
|
||||||
NotifyPushBullet.request_rate_per_sec = 0
|
|
||||||
yield
|
|
||||||
NotifyBase.request_rate_per_sec = backup["NotifyBase"]
|
|
||||||
NotifyPushBullet.request_rate_per_sec = backup["NotifyPushBullet"]
|
|
||||||
|
@ -115,8 +115,6 @@ class AppriseURLTester:
|
|||||||
"""
|
"""
|
||||||
Run a specific test
|
Run a specific test
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyBase.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Our expected instance
|
# Our expected instance
|
||||||
instance = meta.get('instance', None)
|
instance = meta.get('instance', None)
|
||||||
@ -387,8 +385,6 @@ class AppriseURLTester:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if test_requests_exceptions is False:
|
if test_requests_exceptions is False:
|
||||||
# Disable throttling
|
|
||||||
obj.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# check that we're as expected
|
# check that we're as expected
|
||||||
assert obj.notify(
|
assert obj.notify(
|
||||||
@ -472,8 +468,6 @@ class AppriseURLTester:
|
|||||||
attach=attach) == attach_response
|
attach=attach) == attach_response
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Disable throttling
|
|
||||||
obj.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
for _exception in self.req_exceptions:
|
for _exception in self.req_exceptions:
|
||||||
mock_post.side_effect = _exception
|
mock_post.side_effect = _exception
|
||||||
|
@ -119,7 +119,7 @@ def test_plugin_boxcar_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_boxcar_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_boxcar_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyBoxcar() Edge Cases
|
NotifyBoxcar() Edge Cases
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ def test_plugin_bulksms_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_bulksms_edge_cases(mock_post, no_throttling):
|
def test_plugin_bulksms_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyBulkSMS() Edge Cases
|
NotifyBulkSMS() Edge Cases
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ def test_plugin_custom_form_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_custom_form_attachments(mock_post, no_throttling):
|
def test_plugin_custom_form_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyForm() Attachments
|
NotifyForm() Attachments
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ def test_plugin_custom_form_attachments(mock_post, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
def test_plugin_custom_form_edge_cases(mock_get, mock_post, no_throttling):
|
def test_plugin_custom_form_edge_cases(mock_get, mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyForm() Edge Cases
|
NotifyForm() Edge Cases
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ def test_plugin_custom_json_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
def test_plugin_custom_json_edge_cases(mock_get, mock_post, no_throttling):
|
def test_plugin_custom_json_edge_cases(mock_get, mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyJSON() Edge Cases
|
NotifyJSON() Edge Cases
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ def test_plugin_custom_json_edge_cases(mock_get, mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_notify_json_plugin_attachments(mock_post, no_throttling):
|
def test_notify_json_plugin_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyJSON() Attachments
|
NotifyJSON() Attachments
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ def test_plugin_custom_xml_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_notify_xml_plugin_attachments(mock_post, no_throttling):
|
def test_notify_xml_plugin_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyXML() Attachments
|
NotifyXML() Attachments
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ def test_notify_xml_plugin_attachments(mock_post, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
def test_plugin_custom_xml_edge_cases(mock_get, mock_post, no_throttling):
|
def test_plugin_custom_xml_edge_cases(mock_get, mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyXML() Edge Cases
|
NotifyXML() Edge Cases
|
||||||
|
|
||||||
|
@ -161,9 +161,6 @@ def test_plugin_dapnet_config_files(mock_post):
|
|||||||
tag: dapnet_str emerg
|
tag: dapnet_str emerg
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyDapnet.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
mock_post.return_value.status_code = requests.codes.created
|
mock_post.return_value.status_code = requests.codes.created
|
||||||
|
@ -169,7 +169,7 @@ def test_plugin_discord_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_discord_general(mock_post, no_throttling):
|
def test_plugin_discord_general(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyDiscord() General Checks
|
NotifyDiscord() General Checks
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ def test_plugin_discord_general(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_discord_attachments(mock_post, no_throttling):
|
def test_plugin_discord_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyDiscord() Attachment Checks
|
NotifyDiscord() Attachment Checks
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ TEST_URLS = (
|
|||||||
|
|
||||||
@mock.patch('smtplib.SMTP')
|
@mock.patch('smtplib.SMTP')
|
||||||
@mock.patch('smtplib.SMTP_SSL')
|
@mock.patch('smtplib.SMTP_SSL')
|
||||||
def test_plugin_email(mock_smtp, mock_smtpssl, no_throttling):
|
def test_plugin_email(mock_smtp, mock_smtpssl):
|
||||||
"""
|
"""
|
||||||
NotifyEmail() General Checks
|
NotifyEmail() General Checks
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ def test_plugin_email_webbase_lookup(mock_smtp, mock_smtpssl):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('smtplib.SMTP')
|
@mock.patch('smtplib.SMTP')
|
||||||
def test_plugin_email_smtplib_init_fail(mock_smtplib, no_throttling):
|
def test_plugin_email_smtplib_init_fail(mock_smtplib):
|
||||||
"""
|
"""
|
||||||
NotifyEmail() Test exception handling when calling smtplib.SMTP()
|
NotifyEmail() Test exception handling when calling smtplib.SMTP()
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ def test_plugin_email_smtplib_init_fail(mock_smtplib, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('smtplib.SMTP')
|
@mock.patch('smtplib.SMTP')
|
||||||
def test_plugin_email_smtplib_send_okay(mock_smtplib, no_throttling):
|
def test_plugin_email_smtplib_send_okay(mock_smtplib):
|
||||||
"""
|
"""
|
||||||
NotifyEmail() Test a successfully sent email
|
NotifyEmail() Test a successfully sent email
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ def test_plugin_email_smtplib_send_okay(mock_smtplib, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('smtplib.SMTP')
|
@mock.patch('smtplib.SMTP')
|
||||||
def test_plugin_email_smtplib_internationalization(mock_smtp, no_throttling):
|
def test_plugin_email_smtplib_internationalization(mock_smtp):
|
||||||
"""
|
"""
|
||||||
NotifyEmail() Internationalization Handling
|
NotifyEmail() Internationalization Handling
|
||||||
|
|
||||||
@ -735,7 +735,7 @@ def test_plugin_email_dict_variations():
|
|||||||
|
|
||||||
@mock.patch('smtplib.SMTP_SSL')
|
@mock.patch('smtplib.SMTP_SSL')
|
||||||
@mock.patch('smtplib.SMTP')
|
@mock.patch('smtplib.SMTP')
|
||||||
def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl, no_throttling):
|
def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl):
|
||||||
"""
|
"""
|
||||||
NotifyEmail() Test email url parsing
|
NotifyEmail() Test email url parsing
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ def test_plugin_template_urls():
|
|||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_emby_general(mock_post, mock_get, mock_logout,
|
def test_plugin_emby_general(mock_post, mock_get, mock_logout,
|
||||||
mock_login, mock_sessions, no_throttling):
|
mock_login, mock_sessions):
|
||||||
"""
|
"""
|
||||||
NotifyEmby General Tests
|
NotifyEmby General Tests
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ def test_plugin_emby_general(mock_post, mock_get, mock_logout,
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_emby_login(mock_post, mock_get, no_throttling):
|
def test_plugin_emby_login(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyEmby() login()
|
NotifyEmby() login()
|
||||||
|
|
||||||
@ -276,8 +276,7 @@ def test_plugin_emby_login(mock_post, mock_get, no_throttling):
|
|||||||
@mock.patch('apprise.plugins.NotifyEmby.NotifyEmby.logout')
|
@mock.patch('apprise.plugins.NotifyEmby.NotifyEmby.logout')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_emby_sessions(mock_post, mock_get, mock_logout, mock_login,
|
def test_plugin_emby_sessions(mock_post, mock_get, mock_logout, mock_login):
|
||||||
no_throttling):
|
|
||||||
"""
|
"""
|
||||||
NotifyEmby() sessions()
|
NotifyEmby() sessions()
|
||||||
|
|
||||||
@ -372,7 +371,7 @@ def test_plugin_emby_sessions(mock_post, mock_get, mock_logout, mock_login,
|
|||||||
@mock.patch('apprise.plugins.NotifyEmby.NotifyEmby.login')
|
@mock.patch('apprise.plugins.NotifyEmby.NotifyEmby.login')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_emby_logout(mock_post, mock_get, mock_login, no_throttling):
|
def test_plugin_emby_logout(mock_post, mock_get, mock_login):
|
||||||
"""
|
"""
|
||||||
NotifyEmby() logout()
|
NotifyEmby() logout()
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ def test_plugin_fcm_urls():
|
|||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
hasattr(sys, "pypy_version_info"), reason="Does not work reliably on PyPy")
|
hasattr(sys, "pypy_version_info"), reason="Does not work reliably on PyPy")
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_fcm_general_legacy(mock_post, no_throttling):
|
def test_plugin_fcm_general_legacy(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyFCM() General Legacy/APIKey Checks
|
NotifyFCM() General Legacy/APIKey Checks
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ def test_plugin_fcm_general_legacy(mock_post, no_throttling):
|
|||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
'cryptography' not in sys.modules, reason="Requires cryptography")
|
'cryptography' not in sys.modules, reason="Requires cryptography")
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_fcm_general_oauth(mock_post, no_throttling):
|
def test_plugin_fcm_general_oauth(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyFCM() General OAuth Checks
|
NotifyFCM() General OAuth Checks
|
||||||
|
|
||||||
@ -848,7 +848,7 @@ def test_plugin_fcm_cryptography_import_error():
|
|||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
'cryptography' not in sys.modules, reason="Requires cryptography")
|
'cryptography' not in sys.modules, reason="Requires cryptography")
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_fcm_edge_cases(mock_post, no_throttling):
|
def test_plugin_fcm_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyFCM() Edge Cases
|
NotifyFCM() Edge Cases
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ def test_plugin_flock_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_flock_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_flock_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyFlock() Edge Cases
|
NotifyFlock() Edge Cases
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ def test_plugin_gitter_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_gitter_general(mock_post, mock_get, no_throttling):
|
def test_plugin_gitter_general(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyGitter() General Tests
|
NotifyGitter() General Tests
|
||||||
|
|
||||||
|
@ -155,9 +155,6 @@ def test_plugin_gotify_config_files(mock_post):
|
|||||||
tag: gotify_str emerg
|
tag: gotify_str emerg
|
||||||
""" % ('a' * 16, 'b' * 16)
|
""" % ('a' * 16, 'b' * 16)
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyGotify.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
mock_post.return_value.status_code = requests.codes.ok
|
mock_post.return_value.status_code = requests.codes.ok
|
||||||
|
@ -324,7 +324,7 @@ def test_plugin_growl_general(mock_gntp):
|
|||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
'gntp' not in sys.modules, reason="Requires gntp")
|
'gntp' not in sys.modules, reason="Requires gntp")
|
||||||
@mock.patch('gntp.notifier.GrowlNotifier')
|
@mock.patch('gntp.notifier.GrowlNotifier')
|
||||||
def test_plugin_growl_config_files(mock_gntp, no_throttling):
|
def test_plugin_growl_config_files(mock_gntp):
|
||||||
"""
|
"""
|
||||||
NotifyGrowl() Config File Cases
|
NotifyGrowl() Config File Cases
|
||||||
"""
|
"""
|
||||||
|
@ -146,7 +146,7 @@ def test_plugin_guilded_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_guilded_general(mock_post, no_throttling):
|
def test_plugin_guilded_general(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyGuilded() General Checks
|
NotifyGuilded() General Checks
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ def test_plugin_homeassistant_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_homeassistant_general(mock_post, no_throttling):
|
def test_plugin_homeassistant_general(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyHomeAssistant() General Checks
|
NotifyHomeAssistant() General Checks
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ def test_plugin_ifttt_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_ifttt_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_ifttt_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyIFTTT() Edge Cases
|
NotifyIFTTT() Edge Cases
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ def test_plugin_join_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_join_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_join_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyJoin() Edge Cases
|
NotifyJoin() Edge Cases
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ def test_plugin_join_edge_cases(mock_post, mock_get, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_join_config_files(mock_post, no_throttling):
|
def test_plugin_join_config_files(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyJoin() Config File Cases
|
NotifyJoin() Config File Cases
|
||||||
"""
|
"""
|
||||||
|
@ -96,7 +96,7 @@ def test_plugin_kumulos_urls():
|
|||||||
AppriseURLTester(tests=apprise_url_tests).run_all()
|
AppriseURLTester(tests=apprise_url_tests).run_all()
|
||||||
|
|
||||||
|
|
||||||
def test_plugin_kumulos_edge_cases(no_throttling):
|
def test_plugin_kumulos_edge_cases():
|
||||||
"""
|
"""
|
||||||
NotifyKumulos() Edge Cases
|
NotifyKumulos() Edge Cases
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ def test_plugin_mailgun_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_mailgun_attachments(mock_post, no_throttling):
|
def test_plugin_mailgun_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyMailgun() Attachments
|
NotifyMailgun() Attachments
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ def test_plugin_matrix_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_matrix_general(mock_post, mock_get, no_throttling):
|
def test_plugin_matrix_general(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyMatrix() General Tests
|
NotifyMatrix() General Tests
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ def test_plugin_matrix_general(mock_post, mock_get, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_matrix_fetch(mock_post, mock_get, no_throttling):
|
def test_plugin_matrix_fetch(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyMatrix() Server Fetch/API Tests
|
NotifyMatrix() Server Fetch/API Tests
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ def test_plugin_matrix_fetch(mock_post, mock_get, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_matrix_auth(mock_post, mock_get, no_throttling):
|
def test_plugin_matrix_auth(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyMatrix() Server Authentication
|
NotifyMatrix() Server Authentication
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ def test_plugin_matrix_auth(mock_post, mock_get, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_matrix_rooms(mock_post, mock_get, no_throttling):
|
def test_plugin_matrix_rooms(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyMatrix() Room Testing
|
NotifyMatrix() Room Testing
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ def test_plugin_mattermost_urls():
|
|||||||
AppriseURLTester(tests=apprise_url_tests).run_all()
|
AppriseURLTester(tests=apprise_url_tests).run_all()
|
||||||
|
|
||||||
|
|
||||||
def test_plugin_mattermost_edge_cases(no_throttling):
|
def test_plugin_mattermost_edge_cases():
|
||||||
"""
|
"""
|
||||||
NotifyMattermost() Edge Cases
|
NotifyMattermost() Edge Cases
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ def test_plugin_messagebird_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_messagebird_edge_cases(mock_post, no_throttling):
|
def test_plugin_messagebird_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyMessageBird() Edge Cases
|
NotifyMessageBird() Edge Cases
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def test_plugin_mqtt_paho_import_error(mock_post):
|
|||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
'paho' not in sys.modules, reason="Requires paho-mqtt")
|
'paho' not in sys.modules, reason="Requires paho-mqtt")
|
||||||
@mock.patch('paho.mqtt.client.Client')
|
@mock.patch('paho.mqtt.client.Client')
|
||||||
def test_plugin_mqtt_general(mock_client, no_throttling):
|
def test_plugin_mqtt_general(mock_client):
|
||||||
"""
|
"""
|
||||||
NotifyMQTT() General Checks
|
NotifyMQTT() General Checks
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ def test_plugin_msg91_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_msg91_edge_cases(mock_post, no_throttling):
|
def test_plugin_msg91_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyMSG91() Edge Cases
|
NotifyMSG91() Edge Cases
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ def test_plugin_msteams_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_msteams_templating(mock_post, tmpdir, no_throttling):
|
def test_plugin_msteams_templating(mock_post, tmpdir):
|
||||||
"""
|
"""
|
||||||
NotifyMSTeams() Templating
|
NotifyMSTeams() Templating
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ def test_plugin_msteams_templating(mock_post, tmpdir, no_throttling):
|
|||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
hasattr(sys, "pypy_version_info"), reason="Does not work reliably on PyPy")
|
hasattr(sys, "pypy_version_info"), reason="Does not work reliably on PyPy")
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_msteams_yaml_config(mock_post, tmpdir, no_throttling):
|
def test_msteams_yaml_config(mock_post, tmpdir):
|
||||||
"""
|
"""
|
||||||
NotifyMSTeams() YAML Configuration Entries
|
NotifyMSTeams() YAML Configuration Entries
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ def test_plugin_nextcloud_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_nextcloud_edge_cases(mock_post, no_throttling):
|
def test_plugin_nextcloud_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyNextcloud() Edge Cases
|
NotifyNextcloud() Edge Cases
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ def test_plugin_nextcloudtalk_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_nextcloudtalk_edge_cases(mock_post, no_throttling):
|
def test_plugin_nextcloudtalk_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyNextcloud() Edge Cases
|
NotifyNextcloud() Edge Cases
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ def test_plugin_ntfy_chat_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_ntfy_attachments(mock_post, no_throttling):
|
def test_plugin_ntfy_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyNtfy() Attachment Checks
|
NotifyNtfy() Attachment Checks
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ def test_plugin_ntfy_attachments(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_custom_ntfy_edge_cases(mock_post, no_throttling):
|
def test_plugin_custom_ntfy_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyNtfy() Edge Cases
|
NotifyNtfy() Edge Cases
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ def test_plugin_custom_ntfy_edge_cases(mock_post, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
def test_plugin_ntfy_config_files(mock_post, mock_get, no_throttling):
|
def test_plugin_ntfy_config_files(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyNtfy() Config File Cases
|
NotifyNtfy() Config File Cases
|
||||||
"""
|
"""
|
||||||
|
@ -183,7 +183,7 @@ def test_plugin_office365_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_office365_general(mock_post, no_throttling):
|
def test_plugin_office365_general(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyOffice365() General Testing
|
NotifyOffice365() General Testing
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ def test_plugin_office365_general(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_office365_authentication(mock_post, no_throttling):
|
def test_plugin_office365_authentication(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyOffice365() Authentication Testing
|
NotifyOffice365() Authentication Testing
|
||||||
|
|
||||||
|
@ -135,9 +135,6 @@ def test_plugin_opsgenie_urls():
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyOpsgenie.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Run our general tests
|
# Run our general tests
|
||||||
AppriseURLTester(tests=apprise_url_tests).run_all()
|
AppriseURLTester(tests=apprise_url_tests).run_all()
|
||||||
|
|
||||||
@ -174,9 +171,6 @@ def test_plugin_opsgenie_config_files(mock_post):
|
|||||||
tag: opsgenie_str emerg
|
tag: opsgenie_str emerg
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyOpsgenie.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
mock_post.return_value.status_code = requests.codes.ok
|
mock_post.return_value.status_code = requests.codes.ok
|
||||||
|
@ -173,9 +173,6 @@ def test_plugin_prowl_config_files(mock_post):
|
|||||||
tag: prowl_str emerg
|
tag: prowl_str emerg
|
||||||
""" % ('a' * 40, 'b' * 40)
|
""" % ('a' * 40, 'b' * 40)
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyProwl.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
mock_post.return_value.status_code = requests.codes.ok
|
mock_post.return_value.status_code = requests.codes.ok
|
||||||
|
@ -192,7 +192,7 @@ def test_plugin_pushbullet_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_pushbullet_attachments(mock_post, no_throttling):
|
def test_plugin_pushbullet_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyPushBullet() Attachment Checks
|
NotifyPushBullet() Attachment Checks
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ def test_plugin_pushbullet_attachments(mock_post, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_pushbullet_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_pushbullet_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyPushBullet() Edge Cases
|
NotifyPushBullet() Edge Cases
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ def test_plugin_pushed_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_pushed_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_pushed_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyPushed() Edge Cases
|
NotifyPushed() Edge Cases
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ def test_plugin_pushjet_urls():
|
|||||||
AppriseURLTester(tests=apprise_url_tests).run_all()
|
AppriseURLTester(tests=apprise_url_tests).run_all()
|
||||||
|
|
||||||
|
|
||||||
def test_plugin_pushjet_edge_cases(no_throttling):
|
def test_plugin_pushjet_edge_cases():
|
||||||
"""
|
"""
|
||||||
NotifyPushjet() Edge Cases
|
NotifyPushjet() Edge Cases
|
||||||
|
|
||||||
|
@ -196,8 +196,6 @@ def test_plugin_pushover_attachments(mock_post, tmpdir):
|
|||||||
NotifyPushover() Attachment Checks
|
NotifyPushover() Attachment Checks
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyPushover.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Initialize some generic (but valid) tokens
|
# Initialize some generic (but valid) tokens
|
||||||
user_key = 'u' * 30
|
user_key = 'u' * 30
|
||||||
@ -315,8 +313,6 @@ def test_plugin_pushover_edge_cases(mock_post):
|
|||||||
NotifyPushover() Edge Cases
|
NotifyPushover() Edge Cases
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyPushover.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# No token
|
# No token
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
@ -407,9 +403,6 @@ def test_plugin_pushover_config_files(mock_post):
|
|||||||
tag: pushover_str emerg
|
tag: pushover_str emerg
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyPushover.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
mock_post.return_value.status_code = requests.codes.ok
|
mock_post.return_value.status_code = requests.codes.ok
|
||||||
|
@ -226,8 +226,6 @@ def test_plugin_pushsafer_general(mock_post):
|
|||||||
NotifyPushSafer() General Tests
|
NotifyPushSafer() General Tests
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyPushSafer.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Private Key
|
# Private Key
|
||||||
privatekey = 'abc123'
|
privatekey = 'abc123'
|
||||||
|
@ -226,7 +226,7 @@ def test_plugin_reddit_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_reddit_general(mock_post, no_throttling):
|
def test_plugin_reddit_general(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyReddit() General Tests
|
NotifyReddit() General Tests
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ def test_plugin_rocket_chat_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_rocketchat_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_rocketchat_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyRocketChat() Edge Cases
|
NotifyRocketChat() Edge Cases
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ def test_plugin_ryver_urls():
|
|||||||
AppriseURLTester(tests=apprise_url_tests).run_all()
|
AppriseURLTester(tests=apprise_url_tests).run_all()
|
||||||
|
|
||||||
|
|
||||||
def test_plugin_ryver_edge_cases(no_throttling):
|
def test_plugin_ryver_edge_cases():
|
||||||
"""
|
"""
|
||||||
NotifyRyver() Edge Cases
|
NotifyRyver() Edge Cases
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ def test_plugin_sendgrid_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_sendgrid_edge_cases(mock_post, mock_get, no_throttling):
|
def test_plugin_sendgrid_edge_cases(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifySendGrid() Edge Cases
|
NotifySendGrid() Edge Cases
|
||||||
|
|
||||||
|
@ -377,8 +377,6 @@ def test_plugin_ses_attachments(mock_post):
|
|||||||
NotifySES() Attachment Checks
|
NotifySES() Attachment Checks
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifySES.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock return object
|
# Prepare Mock return object
|
||||||
response = mock.Mock()
|
response = mock.Mock()
|
||||||
|
@ -154,7 +154,7 @@ def test_plugin_signal_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_signal_edge_cases(mock_post, no_throttling):
|
def test_plugin_signal_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySignalAPI() Edge Cases
|
NotifySignalAPI() Edge Cases
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ def test_plugin_signal_edge_cases(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_signal_test_based_on_feedback(mock_post, no_throttling):
|
def test_plugin_signal_test_based_on_feedback(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySignalAPI() User Feedback Test
|
NotifySignalAPI() User Feedback Test
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ def test_plugin_signal_test_based_on_feedback(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_notify_signal_plugin_attachments(mock_post, no_throttling):
|
def test_notify_signal_plugin_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySignalAPI() Attachments
|
NotifySignalAPI() Attachments
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ def test_plugin_fcm_cryptography_import_error():
|
|||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
'cryptography' not in sys.modules, reason="Requires cryptography")
|
'cryptography' not in sys.modules, reason="Requires cryptography")
|
||||||
def test_plugin_simplepush_edge_cases(no_throttling):
|
def test_plugin_simplepush_edge_cases():
|
||||||
"""
|
"""
|
||||||
NotifySimplePush() Edge Cases
|
NotifySimplePush() Edge Cases
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ def test_plugin_simplepush_edge_cases(no_throttling):
|
|||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
'cryptography' not in sys.modules, reason="Requires cryptography")
|
'cryptography' not in sys.modules, reason="Requires cryptography")
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_simplepush_general(mock_post, no_throttling):
|
def test_plugin_simplepush_general(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySimplePush() General Tests
|
NotifySimplePush() General Tests
|
||||||
"""
|
"""
|
||||||
|
@ -134,7 +134,7 @@ def test_plugin_sinch_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_sinch_edge_cases(mock_post, no_throttling):
|
def test_plugin_sinch_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySinch() Edge Cases
|
NotifySinch() Edge Cases
|
||||||
|
|
||||||
|
@ -267,8 +267,6 @@ def test_plugin_slack_oauth_access_token(mock_post):
|
|||||||
NotifySlack() OAuth Access Token Tests
|
NotifySlack() OAuth Access Token Tests
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifySlack.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Generate an invalid bot token
|
# Generate an invalid bot token
|
||||||
token = 'xo-invalid'
|
token = 'xo-invalid'
|
||||||
@ -390,8 +388,6 @@ def test_plugin_slack_webhook_mode(mock_post):
|
|||||||
NotifySlack() Webhook Mode Tests
|
NotifySlack() Webhook Mode Tests
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifySlack.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
@ -438,8 +434,6 @@ def test_plugin_slack_send_by_email(mock_get, mock_post):
|
|||||||
NotifySlack() Send by Email Tests
|
NotifySlack() Send by Email Tests
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifySlack.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Generate a (valid) bot token
|
# Generate a (valid) bot token
|
||||||
token = 'xoxb-1234-1234-abc124'
|
token = 'xoxb-1234-1234-abc124'
|
||||||
|
@ -269,7 +269,7 @@ def test_plugin_smseagle_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_smseagle_edge_cases(mock_post, no_throttling):
|
def test_plugin_smseagle_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySMSEagle() Edge Cases
|
NotifySMSEagle() Edge Cases
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ def test_plugin_smseagle_edge_cases(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_smseagle_result_set(mock_post, no_throttling):
|
def test_plugin_smseagle_result_set(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySMSEagle() Result Sets
|
NotifySMSEagle() Result Sets
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ def test_plugin_smseagle_result_set(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_notify_smseagle_plugin_result_list(mock_post, no_throttling):
|
def test_notify_smseagle_plugin_result_list(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySMSEagle() Result List Response
|
NotifySMSEagle() Result List Response
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ def test_notify_smseagle_plugin_result_list(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_notify_smseagle_plugin_attachments(mock_post, no_throttling):
|
def test_notify_smseagle_plugin_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySMSEagle() Attachments
|
NotifySMSEagle() Attachments
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ def test_plugin_smtp2go_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_smtp2go_attachments(mock_post, no_throttling):
|
def test_plugin_smtp2go_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySMTP2Go() Attachments
|
NotifySMTP2Go() Attachments
|
||||||
|
|
||||||
|
@ -329,8 +329,6 @@ def test_plugin_sns_aws_topic_handling(mock_post):
|
|||||||
NotifySNS() AWS Topic Handling
|
NotifySNS() AWS Topic Handling
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifySNS.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
arn_response = \
|
arn_response = \
|
||||||
"""
|
"""
|
||||||
|
@ -263,7 +263,7 @@ def test_plugin_sparkpost_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_sparkpost_throttling(mock_post, no_throttling):
|
def test_plugin_sparkpost_throttling(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySparkPost() Throttling
|
NotifySparkPost() Throttling
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ def test_plugin_sparkpost_throttling(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_sparkpost_attachments(mock_post, no_throttling):
|
def test_plugin_sparkpost_attachments(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifySparkPost() Attachments
|
NotifySparkPost() Attachments
|
||||||
|
|
||||||
|
@ -212,9 +212,6 @@ def test_plugin_telegram_urls():
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyTelegram.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Run our general tests
|
# Run our general tests
|
||||||
AppriseURLTester(tests=apprise_url_tests).run_all()
|
AppriseURLTester(tests=apprise_url_tests).run_all()
|
||||||
|
|
||||||
@ -226,9 +223,6 @@ def test_plugin_telegram_general(mock_post):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyTelegram.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Bot Token
|
# Bot Token
|
||||||
bot_token = '123456789:abcdefg_hijklmnop'
|
bot_token = '123456789:abcdefg_hijklmnop'
|
||||||
invalid_bot_token = 'abcd:123'
|
invalid_bot_token = 'abcd:123'
|
||||||
@ -542,9 +536,6 @@ def test_plugin_telegram_formatting(mock_post):
|
|||||||
NotifyTelegram() formatting tests
|
NotifyTelegram() formatting tests
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyTelegram.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
mock_post.return_value.status_code = requests.codes.ok
|
mock_post.return_value.status_code = requests.codes.ok
|
||||||
@ -885,9 +876,6 @@ def test_plugin_telegram_html_formatting(mock_post):
|
|||||||
"""
|
"""
|
||||||
# on't send anything other than <b>, <i>, <a>,<code> and <pre>
|
# on't send anything other than <b>, <i>, <a>,<code> and <pre>
|
||||||
|
|
||||||
# Disable Throttling to speed testing
|
|
||||||
NotifyTelegram.request_rate_per_sec = 0
|
|
||||||
|
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = requests.Request()
|
mock_post.return_value = requests.Request()
|
||||||
mock_post.return_value.status_code = requests.codes.ok
|
mock_post.return_value.status_code = requests.codes.ok
|
||||||
|
@ -128,7 +128,7 @@ def test_plugin_twilio_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_twilio_auth(mock_post, no_throttling):
|
def test_plugin_twilio_auth(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyTwilio() Auth
|
NotifyTwilio() Auth
|
||||||
- account-wide auth token
|
- account-wide auth token
|
||||||
@ -197,7 +197,7 @@ def test_plugin_twilio_auth(mock_post, no_throttling):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_twilio_edge_cases(mock_post, no_throttling):
|
def test_plugin_twilio_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyTwilio() Edge Cases
|
NotifyTwilio() Edge Cases
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ def test_plugin_twist_init():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_twist_auth(mock_post, mock_get, no_throttling):
|
def test_plugin_twist_auth(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyTwist() login/logout()
|
NotifyTwist() login/logout()
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ def test_plugin_twist_auth(mock_post, mock_get, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_twist_cache(mock_post, mock_get, no_throttling):
|
def test_plugin_twist_cache(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyTwist() Cache Handling
|
NotifyTwist() Cache Handling
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ def test_plugin_twist_cache(mock_post, mock_get, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_twist_fetch(mock_post, mock_get, no_throttling):
|
def test_plugin_twist_fetch(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyTwist() fetch()
|
NotifyTwist() fetch()
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ def test_plugin_twitter_urls():
|
|||||||
|
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_twitter_general(mock_post, mock_get, no_throttling):
|
def test_plugin_twitter_general(mock_post, mock_get):
|
||||||
"""
|
"""
|
||||||
NotifyTwitter() General Tests
|
NotifyTwitter() General Tests
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ def test_plugin_twitter_edge_cases():
|
|||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
def test_plugin_twitter_dm_attachments(mock_get, mock_post, no_throttling):
|
def test_plugin_twitter_dm_attachments(mock_get, mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyTwitter() DM Attachment Checks
|
NotifyTwitter() DM Attachment Checks
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ def test_plugin_twitter_dm_attachments(mock_get, mock_post, no_throttling):
|
|||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@mock.patch('requests.get')
|
@mock.patch('requests.get')
|
||||||
def test_plugin_twitter_tweet_attachments(mock_get, mock_post, no_throttling):
|
def test_plugin_twitter_tweet_attachments(mock_get, mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyTwitter() Tweet Attachment Checks
|
NotifyTwitter() Tweet Attachment Checks
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ def test_plugin_vonage_urls():
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_plugin_vonage_edge_cases(mock_post, no_throttling):
|
def test_plugin_vonage_edge_cases(mock_post):
|
||||||
"""
|
"""
|
||||||
NotifyVonage() Edge Cases
|
NotifyVonage() Edge Cases
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ def test_plugin_zulip_urls():
|
|||||||
AppriseURLTester(tests=apprise_url_tests).run_all()
|
AppriseURLTester(tests=apprise_url_tests).run_all()
|
||||||
|
|
||||||
|
|
||||||
def test_plugin_zulip_edge_cases(no_throttling):
|
def test_plugin_zulip_edge_cases():
|
||||||
"""
|
"""
|
||||||
NotifyZulip() Edge Cases
|
NotifyZulip() Edge Cases
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import logging
|
|||||||
logging.disable(logging.CRITICAL)
|
logging.disable(logging.CRITICAL)
|
||||||
|
|
||||||
|
|
||||||
def test_notify_overflow_truncate(no_throttling):
|
def test_notify_overflow_truncate():
|
||||||
"""
|
"""
|
||||||
API: Overflow Truncate Functionality Testing
|
API: Overflow Truncate Functionality Testing
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ def test_notify_overflow_truncate(no_throttling):
|
|||||||
assert title[0:TestNotification.body_maxlen] == chunks[0].get('body')
|
assert title[0:TestNotification.body_maxlen] == chunks[0].get('body')
|
||||||
|
|
||||||
|
|
||||||
def test_notify_overflow_split(no_throttling):
|
def test_notify_overflow_split():
|
||||||
"""
|
"""
|
||||||
API: Overflow Split Functionality Testing
|
API: Overflow Split Functionality Testing
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ def test_notify_overflow_split(no_throttling):
|
|||||||
offset += len(_body)
|
offset += len(_body)
|
||||||
|
|
||||||
|
|
||||||
def test_notify_overflow_general(no_throttling):
|
def test_notify_overflow_general():
|
||||||
"""
|
"""
|
||||||
API: Overflow General Testing
|
API: Overflow General Testing
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user