diff --git a/test/conftest.py b/test/conftest.py index 5953e28f..30e2ea5f 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -24,4 +24,25 @@ # THE SOFTWARE. import sys import os + +import pytest + +from apprise import NotifyBase +from apprise.plugins.NotifyPushBullet import NotifyPushBullet + sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers')) + + +@pytest.fixture +def no_throttling(): + """ + A pytest fixture which disables Apprise throttling. + """ + backup = {} + backup["NotifyBase"] = NotifyBase.request_rate_per_sec + backup["NotifyPushBullet"] = NotifyPushBullet.request_rate_per_sec + 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"] diff --git a/test/test_plugin_boxcar.py b/test/test_plugin_boxcar.py index 11e9714e..918ff6c8 100644 --- a/test/test_plugin_boxcar.py +++ b/test/test_plugin_boxcar.py @@ -119,13 +119,11 @@ def test_plugin_boxcar_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_boxcar_edge_cases(mock_post, mock_get): +def test_plugin_boxcar_edge_cases(mock_post, mock_get, no_throttling): """ NotifyBoxcar() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Generate some generic message types device = 'A' * 64 diff --git a/test/test_plugin_bulksms.py b/test/test_plugin_bulksms.py index fba74d02..f26d61a6 100644 --- a/test/test_plugin_bulksms.py +++ b/test/test_plugin_bulksms.py @@ -132,13 +132,11 @@ def test_plugin_bulksms_urls(): @mock.patch('requests.post') -def test_plugin_bulksms_edge_cases(mock_post): +def test_plugin_bulksms_edge_cases(mock_post, no_throttling): """ NotifyBulkSMS() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens user = 'abcd' diff --git a/test/test_plugin_custom_form.py b/test/test_plugin_custom_form.py index 435cdf74..b0993fc7 100644 --- a/test/test_plugin_custom_form.py +++ b/test/test_plugin_custom_form.py @@ -152,13 +152,11 @@ def test_plugin_custom_form_urls(): @mock.patch('requests.post') -def test_plugin_custom_form_attachments(mock_post): +def test_plugin_custom_form_attachments(mock_post, no_throttling): """ NotifyForm() Attachments """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 okay_response = requests.Request() okay_response.status_code = requests.codes.ok @@ -226,13 +224,11 @@ def test_plugin_custom_form_attachments(mock_post): @mock.patch('requests.post') @mock.patch('requests.get') -def test_plugin_custom_form_edge_cases(mock_get, mock_post): +def test_plugin_custom_form_edge_cases(mock_get, mock_post, no_throttling): """ NotifyForm() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_custom_json.py b/test/test_plugin_custom_json.py index 7eff2d58..eb2ea12b 100644 --- a/test/test_plugin_custom_json.py +++ b/test/test_plugin_custom_json.py @@ -150,13 +150,11 @@ def test_plugin_custom_json_urls(): @mock.patch('requests.post') @mock.patch('requests.get') -def test_plugin_custom_json_edge_cases(mock_get, mock_post): +def test_plugin_custom_json_edge_cases(mock_get, mock_post, no_throttling): """ NotifyJSON() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_custom_xml.py b/test/test_plugin_custom_xml.py index 635a50b5..c54e1019 100644 --- a/test/test_plugin_custom_xml.py +++ b/test/test_plugin_custom_xml.py @@ -165,13 +165,11 @@ def test_plugin_custom_xml_urls(): @mock.patch('requests.post') -def test_notify_xml_plugin_attachments(mock_post): +def test_notify_xml_plugin_attachments(mock_post, no_throttling): """ NotifyXML() Attachments """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 okay_response = requests.Request() okay_response.status_code = requests.codes.ok @@ -227,13 +225,11 @@ def test_notify_xml_plugin_attachments(mock_post): @mock.patch('requests.post') @mock.patch('requests.get') -def test_plugin_custom_xml_edge_cases(mock_get, mock_post): +def test_plugin_custom_xml_edge_cases(mock_get, mock_post, no_throttling): """ NotifyXML() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_discord.py b/test/test_plugin_discord.py index db14f442..6b8ddee8 100644 --- a/test/test_plugin_discord.py +++ b/test/test_plugin_discord.py @@ -168,13 +168,11 @@ def test_plugin_discord_urls(): @mock.patch('requests.post') -def test_plugin_discord_general(mock_post): +def test_plugin_discord_general(mock_post, no_throttling): """ NotifyDiscord() General Checks """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens webhook_id = 'A' * 24 @@ -364,13 +362,11 @@ def test_plugin_discord_general(mock_post): @mock.patch('requests.post') -def test_plugin_discord_attachments(mock_post): +def test_plugin_discord_attachments(mock_post, no_throttling): """ NotifyDiscord() Attachment Checks """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens webhook_id = 'C' * 24 diff --git a/test/test_plugin_email.py b/test/test_plugin_email.py index 72ee758e..4075adda 100644 --- a/test/test_plugin_email.py +++ b/test/test_plugin_email.py @@ -248,13 +248,11 @@ TEST_URLS = ( @mock.patch('smtplib.SMTP') @mock.patch('smtplib.SMTP_SSL') -def test_plugin_email(mock_smtp, mock_smtpssl): +def test_plugin_email(mock_smtp, mock_smtpssl, no_throttling): """ NotifyEmail() General Checks """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # iterate over our dictionary and test it out for (url, meta) in TEST_URLS: @@ -450,13 +448,11 @@ def test_plugin_email_webbase_lookup(mock_smtp, mock_smtpssl): @mock.patch('smtplib.SMTP') -def test_plugin_email_smtplib_init_fail(mock_smtplib): +def test_plugin_email_smtplib_init_fail(mock_smtplib, no_throttling): """ NotifyEmail() Test exception handling when calling smtplib.SMTP() """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 obj = Apprise.instantiate( 'mailto://user:pass@gmail.com', suppress_exceptions=False) @@ -475,13 +471,11 @@ def test_plugin_email_smtplib_init_fail(mock_smtplib): @mock.patch('smtplib.SMTP') -def test_plugin_email_smtplib_send_okay(mock_smtplib): +def test_plugin_email_smtplib_send_okay(mock_smtplib, no_throttling): """ NotifyEmail() Test a successfully sent email """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Defaults to HTML obj = Apprise.instantiate( @@ -543,13 +537,11 @@ def test_plugin_email_smtplib_send_okay(mock_smtplib): @mock.patch('smtplib.SMTP') -def test_plugin_email_smtplib_internationalization(mock_smtp): +def test_plugin_email_smtplib_internationalization(mock_smtp, no_throttling): """ NotifyEmail() Internationalization Handling """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Defaults to HTML obj = Apprise.instantiate( @@ -741,15 +733,12 @@ def test_plugin_email_dict_variations(): @mock.patch('smtplib.SMTP_SSL') @mock.patch('smtplib.SMTP') -def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl): +def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl, no_throttling): """ NotifyEmail() Test email url parsing """ - # Disable Throttling to speed testing - plugins.NotifyEmail.request_rate_per_sec = 0 - response = mock.Mock() mock_smtp_ssl.return_value = response mock_smtp.return_value = response diff --git a/test/test_plugin_emby.py b/test/test_plugin_emby.py index 1d566ab3..586d873f 100644 --- a/test/test_plugin_emby.py +++ b/test/test_plugin_emby.py @@ -26,7 +26,6 @@ from unittest import mock from json import dumps from apprise import Apprise -from apprise import plugins import requests from helpers import AppriseURLTester @@ -87,13 +86,11 @@ def test_plugin_template_urls(): @mock.patch('requests.get') @mock.patch('requests.post') def test_plugin_emby_general(mock_post, mock_get, mock_logout, - mock_login, mock_sessions): + mock_login, mock_sessions, no_throttling): """ NotifyEmby General Tests """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 req = requests.Request() req.status_code = requests.codes.ok @@ -163,13 +160,11 @@ def test_plugin_emby_general(mock_post, mock_get, mock_logout, @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_emby_login(mock_post, mock_get): +def test_plugin_emby_login(mock_post, mock_get, no_throttling): """ NotifyEmby() login() """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare Mock mock_get.return_value = requests.Request() @@ -279,13 +274,12 @@ def test_plugin_emby_login(mock_post, mock_get): @mock.patch('apprise.plugins.NotifyEmby.logout') @mock.patch('requests.get') @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() """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare Mock mock_get.return_value = requests.Request() @@ -376,13 +370,11 @@ def test_plugin_emby_sessions(mock_post, mock_get, mock_logout, mock_login): @mock.patch('apprise.plugins.NotifyEmby.login') @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_emby_logout(mock_post, mock_get, mock_login): +def test_plugin_emby_logout(mock_post, mock_get, mock_login, no_throttling): """ NotifyEmby() logout() """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare Mock mock_get.return_value = requests.Request() diff --git a/test/test_plugin_fcm.py b/test/test_plugin_fcm.py index 22e9f82d..2700076a 100644 --- a/test/test_plugin_fcm.py +++ b/test/test_plugin_fcm.py @@ -207,13 +207,11 @@ def test_plugin_fcm_urls(): @pytest.mark.skipif( hasattr(sys, "pypy_version_info"), reason="Does not work reliably on PyPy") @mock.patch('requests.post') -def test_plugin_fcm_general_legacy(mock_post): +def test_plugin_fcm_general_legacy(mock_post, no_throttling): """ NotifyFCM() General Legacy/APIKey Checks """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare a good response response = mock.Mock() @@ -334,7 +332,7 @@ def test_plugin_fcm_general_legacy(mock_post): @pytest.mark.skipif( 'cryptography' not in sys.modules, reason="Requires cryptography") @mock.patch('requests.post') -def test_plugin_fcm_general_oauth(mock_post): +def test_plugin_fcm_general_oauth(mock_post, no_throttling): """ NotifyFCM() General OAuth Checks @@ -343,9 +341,6 @@ def test_plugin_fcm_general_oauth(mock_post): # Valid Keyfile path = os.path.join(PRIVATE_KEYFILE_DIR, 'service_account.json') - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Prepare a good response response = mock.Mock() response.content = json.dumps({ @@ -853,13 +848,11 @@ def test_plugin_fcm_cryptography_import_error(): @pytest.mark.skipif( 'cryptography' not in sys.modules, reason="Requires cryptography") @mock.patch('requests.post') -def test_plugin_fcm_edge_cases(mock_post): +def test_plugin_fcm_edge_cases(mock_post, no_throttling): """ NotifyFCM() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare a good response response = mock.Mock() diff --git a/test/test_plugin_flock.py b/test/test_plugin_flock.py index 655d7490..9094a9d1 100644 --- a/test/test_plugin_flock.py +++ b/test/test_plugin_flock.py @@ -163,13 +163,11 @@ def test_plugin_flock_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_flock_edge_cases(mock_post, mock_get): +def test_plugin_flock_edge_cases(mock_post, mock_get, no_throttling): """ NotifyFlock() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initializes the plugin with an invalid token with pytest.raises(TypeError): diff --git a/test/test_plugin_gitter.py b/test/test_plugin_gitter.py index 0d0bfcc5..22c20eeb 100644 --- a/test/test_plugin_gitter.py +++ b/test/test_plugin_gitter.py @@ -114,13 +114,11 @@ def test_plugin_gitter_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_gitter_general(mock_post, mock_get): +def test_plugin_gitter_general(mock_post, mock_get, no_throttling): """ NotifyGitter() General Tests """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Generate a valid token (40 characters) token = 'a' * 40 diff --git a/test/test_plugin_growl.py b/test/test_plugin_growl.py index 53698fb2..b93644ae 100644 --- a/test/test_plugin_growl.py +++ b/test/test_plugin_growl.py @@ -323,7 +323,7 @@ def test_plugin_growl_general(mock_gntp): @pytest.mark.skipif( 'gntp' not in sys.modules, reason="Requires gntp") @mock.patch('gntp.notifier.GrowlNotifier') -def test_plugin_growl_config_files(mock_gntp): +def test_plugin_growl_config_files(mock_gntp, no_throttling): """ NotifyGrowl() Config File Cases """ @@ -350,9 +350,6 @@ def test_plugin_growl_config_files(mock_gntp): tag: growl_str emerg """ - # Disable Throttling to speed testing - apprise.plugins.NotifyGrowl.request_rate_per_sec = 0 - mock_notifier = mock.Mock() mock_gntp.return_value = mock_notifier mock_notifier.notify.return_value = True diff --git a/test/test_plugin_guilded.py b/test/test_plugin_guilded.py index ebbc9d36..3b3f5669 100644 --- a/test/test_plugin_guilded.py +++ b/test/test_plugin_guilded.py @@ -145,13 +145,11 @@ def test_plugin_guilded_urls(): @mock.patch('requests.post') -def test_plugin_guilded_general(mock_post): +def test_plugin_guilded_general(mock_post, no_throttling): """ NotifyGuilded() General Checks """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens webhook_id = 'A' * 24 diff --git a/test/test_plugin_homeassistant.py b/test/test_plugin_homeassistant.py index cfbbcbf3..1c6a8dcc 100644 --- a/test/test_plugin_homeassistant.py +++ b/test/test_plugin_homeassistant.py @@ -124,13 +124,11 @@ def test_plugin_homeassistant_urls(): @mock.patch('requests.post') -def test_plugin_homeassistant_general(mock_post): +def test_plugin_homeassistant_general(mock_post, no_throttling): """ NotifyHomeAssistant() General Checks """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 response = mock.Mock() response.content = '' diff --git a/test/test_plugin_ifttt.py b/test/test_plugin_ifttt.py index ce5206eb..9973582d 100644 --- a/test/test_plugin_ifttt.py +++ b/test/test_plugin_ifttt.py @@ -111,13 +111,11 @@ def test_plugin_ifttt_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_ifttt_edge_cases(mock_post, mock_get): +def test_plugin_ifttt_edge_cases(mock_post, mock_get, no_throttling): """ NotifyIFTTT() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens webhook_id = 'webhook_id' @@ -135,9 +133,6 @@ def test_plugin_ifttt_edge_cases(mock_post, mock_get): with pytest.raises(TypeError): plugins.NotifyIFTTT(webhook_id=None, events=None) - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Initializes the plugin with an invalid webhook id with pytest.raises(TypeError): plugins.NotifyIFTTT(webhook_id=None, events=events) diff --git a/test/test_plugin_join.py b/test/test_plugin_join.py index 92717b72..31422cfe 100644 --- a/test/test_plugin_join.py +++ b/test/test_plugin_join.py @@ -129,13 +129,11 @@ def test_plugin_join_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_join_edge_cases(mock_post, mock_get): +def test_plugin_join_edge_cases(mock_post, mock_get, no_throttling): """ NotifyJoin() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Generate some generic message types device = 'A' * 32 @@ -172,7 +170,7 @@ def test_plugin_join_edge_cases(mock_post, mock_get): @mock.patch('requests.post') -def test_plugin_join_config_files(mock_post): +def test_plugin_join_config_files(mock_post, no_throttling): """ NotifyJoin() Config File Cases """ @@ -199,9 +197,6 @@ def test_plugin_join_config_files(mock_post): tag: join_str emerg """ % ('a' * 32, 'b' * 32, 'c' * 32, 'd' * 32) - # Disable Throttling to speed testing - plugins.NotifyJoin.request_rate_per_sec = 0 - # Prepare Mock mock_post.return_value = requests.Request() mock_post.return_value.status_code = requests.codes.ok diff --git a/test/test_plugin_kumulos.py b/test/test_plugin_kumulos.py index 9e2acf4d..3c9ac4bb 100644 --- a/test/test_plugin_kumulos.py +++ b/test/test_plugin_kumulos.py @@ -95,13 +95,11 @@ def test_plugin_kumulos_urls(): AppriseURLTester(tests=apprise_url_tests).run_all() -def test_plugin_kumulos_edge_cases(): +def test_plugin_kumulos_edge_cases(no_throttling): """ NotifyKumulos() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Invalid API Key with pytest.raises(TypeError): diff --git a/test/test_plugin_mailgun.py b/test/test_plugin_mailgun.py index 855664ff..71f443b5 100644 --- a/test/test_plugin_mailgun.py +++ b/test/test_plugin_mailgun.py @@ -176,13 +176,11 @@ def test_plugin_mailgun_urls(): @mock.patch('requests.post') -def test_plugin_mailgun_attachments(mock_post): +def test_plugin_mailgun_attachments(mock_post, no_throttling): """ NotifyMailgun() Attachments """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 okay_response = requests.Request() okay_response.status_code = requests.codes.ok diff --git a/test/test_plugin_matrix.py b/test/test_plugin_matrix.py index 5637927b..8889e763 100644 --- a/test/test_plugin_matrix.py +++ b/test/test_plugin_matrix.py @@ -196,13 +196,11 @@ def test_plugin_matrix_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_matrix_general(mock_post, mock_get): +def test_plugin_matrix_general(mock_post, mock_get, no_throttling): """ NotifyMatrix() General Tests """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 response_obj = { 'room_id': '!abc123:localhost', @@ -353,13 +351,11 @@ def test_plugin_matrix_general(mock_post, mock_get): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_matrix_fetch(mock_post, mock_get): +def test_plugin_matrix_fetch(mock_post, mock_get, no_throttling): """ NotifyMatrix() Server Fetch/API Tests """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 response_obj = { 'room_id': '!abc123:localhost', @@ -406,9 +402,6 @@ def test_plugin_matrix_fetch(mock_post, mock_get): # We would hve failed to send our notification assert obj.send(user='test', password='passwd', body="test") is False - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - response_obj = { # Registration 'access_token': 'abcd1234', @@ -460,13 +453,11 @@ def test_plugin_matrix_fetch(mock_post, mock_get): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_matrix_auth(mock_post, mock_get): +def test_plugin_matrix_auth(mock_post, mock_get, no_throttling): """ NotifyMatrix() Server Authentication """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 response_obj = { # Registration @@ -556,13 +547,11 @@ def test_plugin_matrix_auth(mock_post, mock_get): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_matrix_rooms(mock_post, mock_get): +def test_plugin_matrix_rooms(mock_post, mock_get, no_throttling): """ NotifyMatrix() Room Testing """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 response_obj = { # Registration diff --git a/test/test_plugin_mattermost.py b/test/test_plugin_mattermost.py index 06f6504a..afa72c57 100644 --- a/test/test_plugin_mattermost.py +++ b/test/test_plugin_mattermost.py @@ -122,13 +122,11 @@ def test_plugin_mattermost_urls(): AppriseURLTester(tests=apprise_url_tests).run_all() -def test_plugin_mattermost_edge_cases(): +def test_plugin_mattermost_edge_cases(no_throttling): """ NotifyMattermost() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Invalid Authorization Token with pytest.raises(TypeError): diff --git a/test/test_plugin_messagebird.py b/test/test_plugin_messagebird.py index 49fbc6d0..e43a7f7d 100644 --- a/test/test_plugin_messagebird.py +++ b/test/test_plugin_messagebird.py @@ -103,13 +103,11 @@ def test_plugin_messagebird_urls(): @mock.patch('requests.post') -def test_plugin_messagebird_edge_cases(mock_post): +def test_plugin_messagebird_edge_cases(mock_post, no_throttling): """ NotifyMessageBird() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_mqtt.py b/test/test_plugin_mqtt.py index 9d33f862..6f39f2f0 100644 --- a/test/test_plugin_mqtt.py +++ b/test/test_plugin_mqtt.py @@ -54,13 +54,11 @@ def test_plugin_mqtt_paho_import_error(mock_post): @pytest.mark.skipif( 'paho' not in sys.modules, reason="Requires paho-mqtt") @mock.patch('paho.mqtt.client.Client') -def test_plugin_mqtt_general(mock_client): +def test_plugin_mqtt_general(mock_client, no_throttling): """ NotifyMQTT() General Checks """ - # Speed up request rate for testing - apprise.plugins.NotifyBase.request_rate_per_sec = 0 # our call to publish() response object publish_result = mock.Mock() diff --git a/test/test_plugin_msg91.py b/test/test_plugin_msg91.py index af3fad3d..a01e6b97 100644 --- a/test/test_plugin_msg91.py +++ b/test/test_plugin_msg91.py @@ -126,13 +126,11 @@ def test_plugin_msg91_urls(): @mock.patch('requests.post') -def test_plugin_msg91_edge_cases(mock_post): +def test_plugin_msg91_edge_cases(mock_post, no_throttling): """ NotifyMSG91() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_msteams.py b/test/test_plugin_msteams.py index b6a07cf3..4f61d0ed 100644 --- a/test/test_plugin_msteams.py +++ b/test/test_plugin_msteams.py @@ -176,13 +176,11 @@ def test_plugin_msteams_urls(): @mock.patch('requests.post') -def test_plugin_msteams_templating(mock_post, tmpdir): +def test_plugin_msteams_templating(mock_post, tmpdir, no_throttling): """ NotifyMSTeams() Templating """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare Mock mock_post.return_value = requests.Request() @@ -387,15 +385,12 @@ def test_plugin_msteams_templating(mock_post, tmpdir): @pytest.mark.skipif( hasattr(sys, "pypy_version_info"), reason="Does not work reliably on PyPy") @mock.patch('requests.post') -def test_msteams_yaml_config(mock_post, tmpdir): +def test_msteams_yaml_config(mock_post, tmpdir, no_throttling): """ NotifyMSTeams() YAML Configuration Entries """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Prepare Mock mock_post.return_value = requests.Request() mock_post.return_value.status_code = requests.codes.ok diff --git a/test/test_plugin_nextcloud.py b/test/test_plugin_nextcloud.py index 876abb83..7e003e24 100644 --- a/test/test_plugin_nextcloud.py +++ b/test/test_plugin_nextcloud.py @@ -131,13 +131,11 @@ def test_plugin_nextcloud_urls(): @mock.patch('requests.post') -def test_plugin_nextcloud_edge_cases(mock_post): +def test_plugin_nextcloud_edge_cases(mock_post, no_throttling): """ NotifyNextcloud() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # A response robj = mock.Mock() diff --git a/test/test_plugin_nextcloudtalk.py b/test/test_plugin_nextcloudtalk.py index fe42cc54..0f15a518 100644 --- a/test/test_plugin_nextcloudtalk.py +++ b/test/test_plugin_nextcloudtalk.py @@ -121,13 +121,11 @@ def test_plugin_nextcloudtalk_urls(): @mock.patch('requests.post') -def test_plugin_nextcloudtalk_edge_cases(mock_post): +def test_plugin_nextcloudtalk_edge_cases(mock_post, no_throttling): """ NotifyNextcloud() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # A response robj = mock.Mock() diff --git a/test/test_plugin_ntfy.py b/test/test_plugin_ntfy.py index be4e0873..e6c49612 100644 --- a/test/test_plugin_ntfy.py +++ b/test/test_plugin_ntfy.py @@ -234,13 +234,11 @@ def test_plugin_ntfy_chat_urls(): @mock.patch('requests.post') -def test_plugin_ntfy_attachments(mock_post): +def test_plugin_ntfy_attachments(mock_post, no_throttling): """ NotifyNtfy() Attachment Checks """ - # Disable Throttling to speed testing - plugins.NotifyNtfy.request_rate_per_sec = 0 # Prepare Mock return object response = mock.Mock() @@ -351,13 +349,11 @@ def test_plugin_ntfy_attachments(mock_post): @mock.patch('requests.post') -def test_plugin_custom_ntfy_edge_cases(mock_post): +def test_plugin_custom_ntfy_edge_cases(mock_post, no_throttling): """ NotifyNtfy() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() @@ -430,7 +426,7 @@ def test_plugin_custom_ntfy_edge_cases(mock_post): @mock.patch('requests.post') @mock.patch('requests.get') -def test_plugin_ntfy_config_files(mock_post, mock_get): +def test_plugin_ntfy_config_files(mock_post, mock_get, no_throttling): """ NotifyNtfy() Config File Cases """ @@ -459,9 +455,6 @@ def test_plugin_ntfy_config_files(mock_post, mock_get): tag: ntfy_str max """ - # Disable Throttling to speed testing - plugins.NotifyNtfy.request_rate_per_sec = 0 - # Prepare Mock mock_post.return_value = requests.Request() mock_post.return_value.status_code = requests.codes.ok diff --git a/test/test_plugin_office365.py b/test/test_plugin_office365.py index e63bbce7..411d8e69 100644 --- a/test/test_plugin_office365.py +++ b/test/test_plugin_office365.py @@ -183,13 +183,11 @@ def test_plugin_office365_urls(): @mock.patch('requests.post') -def test_plugin_office365_general(mock_post): +def test_plugin_office365_general(mock_post, no_throttling): """ NotifyOffice365() General Testing """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens email = 'user@example.net' @@ -301,13 +299,11 @@ def test_plugin_office365_general(mock_post): @mock.patch('requests.post') -def test_plugin_office365_authentication(mock_post): +def test_plugin_office365_authentication(mock_post, no_throttling): """ NotifyOffice365() Authentication Testing """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens tenant = 'ff-gg-hh-ii-jj' diff --git a/test/test_plugin_pushbullet.py b/test/test_plugin_pushbullet.py index 316190c3..238d4db2 100644 --- a/test/test_plugin_pushbullet.py +++ b/test/test_plugin_pushbullet.py @@ -192,13 +192,11 @@ def test_plugin_pushbullet_urls(): @mock.patch('requests.post') -def test_plugin_pushbullet_attachments(mock_post): +def test_plugin_pushbullet_attachments(mock_post, no_throttling): """ NotifyPushBullet() Attachment Checks """ - # Disable Throttling to speed testing - plugins.NotifyPushBullet.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens access_token = 't' * 32 @@ -335,13 +333,11 @@ def test_plugin_pushbullet_attachments(mock_post): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_pushbullet_edge_cases(mock_post, mock_get): +def test_plugin_pushbullet_edge_cases(mock_post, mock_get, no_throttling): """ NotifyPushBullet() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Initialize some generic (but valid) tokens accesstoken = 'a' * 32 diff --git a/test/test_plugin_pushed.py b/test/test_plugin_pushed.py index 54a5e85d..1094439b 100644 --- a/test/test_plugin_pushed.py +++ b/test/test_plugin_pushed.py @@ -145,13 +145,11 @@ def test_plugin_pushed_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_pushed_edge_cases(mock_post, mock_get): +def test_plugin_pushed_edge_cases(mock_post, mock_get, no_throttling): """ NotifyPushed() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Chat ID recipients = '@ABCDEFG, @DEFGHIJ, #channel, #channel2' diff --git a/test/test_plugin_pushjet.py b/test/test_plugin_pushjet.py index f4503661..4133e01c 100644 --- a/test/test_plugin_pushjet.py +++ b/test/test_plugin_pushjet.py @@ -96,13 +96,11 @@ def test_plugin_pushjet_urls(): AppriseURLTester(tests=apprise_url_tests).run_all() -def test_plugin_pushjet_edge_cases(): +def test_plugin_pushjet_edge_cases(no_throttling): """ NotifyPushjet() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # No application Key specified with pytest.raises(TypeError): diff --git a/test/test_plugin_reddit.py b/test/test_plugin_reddit.py index cce440d3..d803493c 100644 --- a/test/test_plugin_reddit.py +++ b/test/test_plugin_reddit.py @@ -225,14 +225,12 @@ def test_plugin_reddit_urls(): @mock.patch('requests.post') -def test_plugin_reddit_general(mock_post): +def test_plugin_reddit_general(mock_post, no_throttling): """ NotifyReddit() General Tests """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - plugins.NotifyReddit.clock_skew = timedelta(seconds=0) + NotifyReddit.clock_skew = timedelta(seconds=0) # Generate a valid credentials: kwargs = { diff --git a/test/test_plugin_rocket_chat.py b/test/test_plugin_rocket_chat.py index 482d9111..f852231d 100644 --- a/test/test_plugin_rocket_chat.py +++ b/test/test_plugin_rocket_chat.py @@ -228,13 +228,11 @@ def test_plugin_rocket_chat_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_rocketchat_edge_cases(mock_post, mock_get): +def test_plugin_rocketchat_edge_cases(mock_post, mock_get, no_throttling): """ NotifyRocketChat() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Chat ID recipients = 'AbcD1245, @l2g, @lead2gold, #channel, #channel2' diff --git a/test/test_plugin_ryver.py b/test/test_plugin_ryver.py index f4ce7962..52d89743 100644 --- a/test/test_plugin_ryver.py +++ b/test/test_plugin_ryver.py @@ -122,13 +122,11 @@ def test_plugin_ryver_urls(): AppriseURLTester(tests=apprise_url_tests).run_all() -def test_plugin_ryver_edge_cases(): +def test_plugin_ryver_edge_cases(no_throttling): """ NotifyRyver() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # No token with pytest.raises(TypeError): diff --git a/test/test_plugin_sendgrid.py b/test/test_plugin_sendgrid.py index 854a8cef..8c15a0f7 100644 --- a/test/test_plugin_sendgrid.py +++ b/test/test_plugin_sendgrid.py @@ -126,13 +126,11 @@ def test_plugin_sendgrid_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_sendgrid_edge_cases(mock_post, mock_get): +def test_plugin_sendgrid_edge_cases(mock_post, mock_get, no_throttling): """ NotifySendGrid() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # no apikey with pytest.raises(TypeError): diff --git a/test/test_plugin_signal.py b/test/test_plugin_signal.py index 7c0aafac..b401c0fe 100644 --- a/test/test_plugin_signal.py +++ b/test/test_plugin_signal.py @@ -154,13 +154,11 @@ def test_plugin_signal_urls(): @mock.patch('requests.post') -def test_plugin_signal_edge_cases(mock_post): +def test_plugin_signal_edge_cases(mock_post, no_throttling): """ NotifySignalAPI() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() @@ -209,13 +207,11 @@ def test_plugin_signal_edge_cases(mock_post): @mock.patch('requests.post') -def test_plugin_signal_test_based_on_feedback(mock_post): +def test_plugin_signal_test_based_on_feedback(mock_post, no_throttling): """ NotifySignalAPI() User Feedback Test """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() @@ -309,13 +305,11 @@ def test_plugin_signal_test_based_on_feedback(mock_post): @mock.patch('requests.post') -def test_notify_signal_plugin_attachments(mock_post): +def test_notify_signal_plugin_attachments(mock_post, no_throttling): """ NotifySignalAPI() Attachments """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 okay_response = requests.Request() okay_response.status_code = requests.codes.ok diff --git a/test/test_plugin_simplepush.py b/test/test_plugin_simplepush.py index 68a59fc8..c46c946c 100644 --- a/test/test_plugin_simplepush.py +++ b/test/test_plugin_simplepush.py @@ -130,13 +130,11 @@ def test_plugin_fcm_cryptography_import_error(): @pytest.mark.skipif( 'cryptography' not in sys.modules, reason="Requires cryptography") -def test_plugin_simplepush_edge_cases(): +def test_plugin_simplepush_edge_cases(no_throttling): """ NotifySimplePush() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # No token with pytest.raises(TypeError): @@ -156,12 +154,10 @@ def test_plugin_simplepush_edge_cases(): @pytest.mark.skipif( 'cryptography' not in sys.modules, reason="Requires cryptography") @mock.patch('requests.post') -def test_plugin_simplepush_general(mock_post): +def test_plugin_simplepush_general(mock_post, no_throttling): """ NotifySimplePush() General Tests """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare a good response response = mock.Mock() diff --git a/test/test_plugin_sinch.py b/test/test_plugin_sinch.py index 29986996..3642ec57 100644 --- a/test/test_plugin_sinch.py +++ b/test/test_plugin_sinch.py @@ -133,13 +133,11 @@ def test_plugin_sinch_urls(): @mock.patch('requests.post') -def test_plugin_sinch_edge_cases(mock_post): +def test_plugin_sinch_edge_cases(mock_post, no_throttling): """ NotifySinch() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_smseagle.py b/test/test_plugin_smseagle.py index 7e7acb9a..f9b0f3f3 100644 --- a/test/test_plugin_smseagle.py +++ b/test/test_plugin_smseagle.py @@ -269,13 +269,11 @@ def test_plugin_smseagle_urls(): @mock.patch('requests.post') -def test_plugin_smseagle_edge_cases(mock_post): +def test_plugin_smseagle_edge_cases(mock_post, no_throttling): """ NotifySMSEagle() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() @@ -321,13 +319,11 @@ def test_plugin_smseagle_edge_cases(mock_post): @mock.patch('requests.post') -def test_plugin_smseagle_result_set(mock_post): +def test_plugin_smseagle_result_set(mock_post, no_throttling): """ NotifySMSEagle() Result Sets """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() @@ -539,13 +535,11 @@ def test_plugin_smseagle_result_set(mock_post): @mock.patch('requests.post') -def test_notify_smseagle_plugin_result_list(mock_post): +def test_notify_smseagle_plugin_result_list(mock_post, no_throttling): """ NotifySMSEagle() Result List Response """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 okay_response = requests.Request() okay_response.status_code = requests.codes.ok @@ -583,13 +577,11 @@ def test_notify_smseagle_plugin_result_list(mock_post): @mock.patch('requests.post') -def test_notify_smseagle_plugin_attachments(mock_post): +def test_notify_smseagle_plugin_attachments(mock_post, no_throttling): """ NotifySMSEagle() Attachments """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 okay_response = requests.Request() okay_response.status_code = requests.codes.ok diff --git a/test/test_plugin_smtp2go.py b/test/test_plugin_smtp2go.py index c4c2af6a..b9b570c9 100644 --- a/test/test_plugin_smtp2go.py +++ b/test/test_plugin_smtp2go.py @@ -155,13 +155,11 @@ def test_plugin_smtp2go_urls(): @mock.patch('requests.post') -def test_plugin_smtp2go_attachments(mock_post): +def test_plugin_smtp2go_attachments(mock_post, no_throttling): """ NotifySMTP2Go() Attachments """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 okay_response = requests.Request() okay_response.status_code = requests.codes.ok diff --git a/test/test_plugin_sparkpost.py b/test/test_plugin_sparkpost.py index ced52c64..0c913215 100644 --- a/test/test_plugin_sparkpost.py +++ b/test/test_plugin_sparkpost.py @@ -263,14 +263,12 @@ def test_plugin_sparkpost_urls(): @mock.patch('requests.post') -def test_plugin_sparkpost_throttling(mock_post): +def test_plugin_sparkpost_throttling(mock_post, no_throttling): """ NotifySparkPost() Throttling """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 plugins.NotifySparkPost.sparkpost_retry_wait_sec = 0.1 plugins.NotifySparkPost.sparkpost_retry_attempts = 3 @@ -334,13 +332,11 @@ def test_plugin_sparkpost_throttling(mock_post): @mock.patch('requests.post') -def test_plugin_sparkpost_attachments(mock_post): +def test_plugin_sparkpost_attachments(mock_post, no_throttling): """ NotifySparkPost() Attachments """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 plugins.NotifySparkPost.sparkpost_retry_wait_sec = 0.1 plugins.NotifySparkPost.sparkpost_retry_attempts = 3 diff --git a/test/test_plugin_twilio.py b/test/test_plugin_twilio.py index 77df8971..72065029 100644 --- a/test/test_plugin_twilio.py +++ b/test/test_plugin_twilio.py @@ -128,15 +128,13 @@ def test_plugin_twilio_urls(): @mock.patch('requests.post') -def test_plugin_twilio_auth(mock_post): +def test_plugin_twilio_auth(mock_post, no_throttling): """ NotifyTwilio() Auth - account-wide auth token - API key and its own auth token """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 response = mock.Mock() response.content = '' @@ -199,13 +197,11 @@ def test_plugin_twilio_auth(mock_post): @mock.patch('requests.post') -def test_plugin_twilio_edge_cases(mock_post): +def test_plugin_twilio_edge_cases(mock_post, no_throttling): """ NotifyTwilio() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_twist.py b/test/test_plugin_twist.py index ae428bcf..b95c77c8 100644 --- a/test/test_plugin_twist.py +++ b/test/test_plugin_twist.py @@ -164,13 +164,11 @@ def test_plugin_twist_init(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_twist_auth(mock_post, mock_get): +def test_plugin_twist_auth(mock_post, mock_get, no_throttling): """ NotifyTwist() login/logout() """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare Mock mock_get.return_value = requests.Request() @@ -268,13 +266,11 @@ def test_plugin_twist_auth(mock_post, mock_get): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_twist_cache(mock_post, mock_get): +def test_plugin_twist_cache(mock_post, mock_get, no_throttling): """ NotifyTwist() Cache Handling """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 def _response(url, *args, **kwargs): @@ -355,7 +351,7 @@ def test_plugin_twist_cache(mock_post, mock_get): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_twist_fetch(mock_post, mock_get): +def test_plugin_twist_fetch(mock_post, mock_get, no_throttling): """ NotifyTwist() fetch() @@ -364,8 +360,6 @@ def test_plugin_twist_fetch(mock_post, mock_get): happens to expire. This tests these edge cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Track our iteration; by tracing within an object, we can re-reference # it within a function scope. diff --git a/test/test_plugin_twitter.py b/test/test_plugin_twitter.py index afd94a80..d667dde4 100644 --- a/test/test_plugin_twitter.py +++ b/test/test_plugin_twitter.py @@ -212,7 +212,7 @@ def test_plugin_twitter_urls(): @mock.patch('requests.get') @mock.patch('requests.post') -def test_plugin_twitter_general(mock_post, mock_get): +def test_plugin_twitter_general(mock_post, mock_get, no_throttling): """ NotifyTwitter() General Tests @@ -228,9 +228,6 @@ def test_plugin_twitter_general(mock_post, mock_get): 'id': 9876, }] - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Epoch time: epoch = datetime.utcfromtimestamp(0) @@ -423,7 +420,7 @@ def test_plugin_twitter_edge_cases(): @mock.patch('requests.post') @mock.patch('requests.get') -def test_plugin_twitter_dm_attachments(mock_get, mock_post): +def test_plugin_twitter_dm_attachments(mock_get, mock_post, no_throttling): """ NotifyTwitter() DM Attachment Checks @@ -439,9 +436,6 @@ def test_plugin_twitter_dm_attachments(mock_get, mock_post): 'id': 9876, } - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Prepare a good DM response good_dm_response = mock.Mock() good_dm_response.content = dumps(good_dm_response_obj) @@ -642,7 +636,7 @@ def test_plugin_twitter_dm_attachments(mock_get, mock_post): @mock.patch('requests.post') @mock.patch('requests.get') -def test_plugin_twitter_tweet_attachments(mock_get, mock_post): +def test_plugin_twitter_tweet_attachments(mock_get, mock_post, no_throttling): """ NotifyTwitter() Tweet Attachment Checks @@ -658,9 +652,6 @@ def test_plugin_twitter_tweet_attachments(mock_get, mock_post): 'id': 9876, } - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Prepare a good DM response good_tweet_response = mock.Mock() good_tweet_response.content = dumps(good_tweet_response_obj) diff --git a/test/test_plugin_vonage.py b/test/test_plugin_vonage.py index 84a64cc0..cb7b3507 100644 --- a/test/test_plugin_vonage.py +++ b/test/test_plugin_vonage.py @@ -180,13 +180,11 @@ def test_plugin_vonage_urls(): @mock.patch('requests.post') -def test_plugin_vonage_edge_cases(mock_post): +def test_plugin_vonage_edge_cases(mock_post, no_throttling): """ NotifyVonage() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # Prepare our response response = requests.Request() diff --git a/test/test_plugin_zulip.py b/test/test_plugin_zulip.py index f25a0847..d9284d1b 100644 --- a/test/test_plugin_zulip.py +++ b/test/test_plugin_zulip.py @@ -120,13 +120,11 @@ def test_plugin_zulip_urls(): AppriseURLTester(tests=apprise_url_tests).run_all() -def test_plugin_zulip_edge_cases(): +def test_plugin_zulip_edge_cases(no_throttling): """ NotifyZulip() Edge Cases """ - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 # must be 32 characters long token = 'a' * 32 diff --git a/test/test_rest_plugins.py b/test/test_rest_plugins.py index 989dcec4..bbbc569d 100644 --- a/test/test_rest_plugins.py +++ b/test/test_rest_plugins.py @@ -28,7 +28,6 @@ from random import choice from string import ascii_uppercase as str_alpha from string import digits as str_num -from apprise import plugins from apprise import NotifyBase from apprise.common import NotifyFormat from apprise.common import OverflowMode @@ -38,7 +37,7 @@ import logging logging.disable(logging.CRITICAL) -def test_notify_overflow_truncate(): +def test_notify_overflow_truncate(no_throttling): """ API: Overflow Truncate Functionality Testing @@ -47,9 +46,6 @@ def test_notify_overflow_truncate(): # A little preparation # - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Number of characters per line row = 24 @@ -210,7 +206,7 @@ def test_notify_overflow_truncate(): assert title[0:TestNotification.body_maxlen] == chunks[0].get('body') -def test_notify_overflow_split(): +def test_notify_overflow_split(no_throttling): """ API: Overflow Split Functionality Testing @@ -220,9 +216,6 @@ def test_notify_overflow_split(): # A little preparation # - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # Number of characters per line row = 24 @@ -386,7 +379,7 @@ def test_notify_overflow_split(): offset += len(_body) -def test_notify_overflow_general(): +def test_notify_overflow_general(no_throttling): """ API: Overflow General Testing @@ -396,9 +389,6 @@ def test_notify_overflow_general(): # A little preparation # - # Disable Throttling to speed testing - plugins.NotifyBase.request_rate_per_sec = 0 - # # First Test: Truncated Title #