Tests: Use `no_throttling` fixture everywhere

pull/687/head
Andreas Motl 2022-10-09 02:01:50 +02:00
parent 85daf12fbd
commit c797d1e2eb
48 changed files with 105 additions and 267 deletions

View File

@ -24,4 +24,25 @@
# THE SOFTWARE. # THE SOFTWARE.
import sys import sys
import os 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')) 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"]

View File

@ -119,13 +119,11 @@ 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): def test_plugin_boxcar_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifyBoxcar() Edge Cases NotifyBoxcar() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Generate some generic message types # Generate some generic message types
device = 'A' * 64 device = 'A' * 64

View File

@ -132,13 +132,11 @@ def test_plugin_bulksms_urls():
@mock.patch('requests.post') @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 NotifyBulkSMS() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
user = 'abcd' user = 'abcd'

View File

@ -152,13 +152,11 @@ def test_plugin_custom_form_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_custom_form_attachments(mock_post): def test_plugin_custom_form_attachments(mock_post, no_throttling):
""" """
NotifyForm() Attachments NotifyForm() Attachments
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
okay_response = requests.Request() okay_response = requests.Request()
okay_response.status_code = requests.codes.ok 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.post')
@mock.patch('requests.get') @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 NotifyForm() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -150,13 +150,11 @@ 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): def test_plugin_custom_json_edge_cases(mock_get, mock_post, no_throttling):
""" """
NotifyJSON() Edge Cases NotifyJSON() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -165,13 +165,11 @@ def test_plugin_custom_xml_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_notify_xml_plugin_attachments(mock_post): def test_notify_xml_plugin_attachments(mock_post, no_throttling):
""" """
NotifyXML() Attachments NotifyXML() Attachments
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
okay_response = requests.Request() okay_response = requests.Request()
okay_response.status_code = requests.codes.ok 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.post')
@mock.patch('requests.get') @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 NotifyXML() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -168,13 +168,11 @@ def test_plugin_discord_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_discord_general(mock_post): def test_plugin_discord_general(mock_post, no_throttling):
""" """
NotifyDiscord() General Checks NotifyDiscord() General Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
webhook_id = 'A' * 24 webhook_id = 'A' * 24
@ -364,13 +362,11 @@ def test_plugin_discord_general(mock_post):
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_discord_attachments(mock_post): def test_plugin_discord_attachments(mock_post, no_throttling):
""" """
NotifyDiscord() Attachment Checks NotifyDiscord() Attachment Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
webhook_id = 'C' * 24 webhook_id = 'C' * 24

View File

@ -248,13 +248,11 @@ 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): def test_plugin_email(mock_smtp, mock_smtpssl, no_throttling):
""" """
NotifyEmail() General Checks NotifyEmail() General Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# iterate over our dictionary and test it out # iterate over our dictionary and test it out
for (url, meta) in TEST_URLS: for (url, meta) in TEST_URLS:
@ -450,13 +448,11 @@ 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): def test_plugin_email_smtplib_init_fail(mock_smtplib, no_throttling):
""" """
NotifyEmail() Test exception handling when calling smtplib.SMTP() NotifyEmail() Test exception handling when calling smtplib.SMTP()
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
obj = Apprise.instantiate( obj = Apprise.instantiate(
'mailto://user:pass@gmail.com', suppress_exceptions=False) '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') @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 NotifyEmail() Test a successfully sent email
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Defaults to HTML # Defaults to HTML
obj = Apprise.instantiate( obj = Apprise.instantiate(
@ -543,13 +537,11 @@ def test_plugin_email_smtplib_send_okay(mock_smtplib):
@mock.patch('smtplib.SMTP') @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 NotifyEmail() Internationalization Handling
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Defaults to HTML # Defaults to HTML
obj = Apprise.instantiate( obj = Apprise.instantiate(
@ -741,15 +733,12 @@ 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): def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl, no_throttling):
""" """
NotifyEmail() Test email url parsing NotifyEmail() Test email url parsing
""" """
# Disable Throttling to speed testing
plugins.NotifyEmail.request_rate_per_sec = 0
response = mock.Mock() response = mock.Mock()
mock_smtp_ssl.return_value = response mock_smtp_ssl.return_value = response
mock_smtp.return_value = response mock_smtp.return_value = response

View File

@ -26,7 +26,6 @@ from unittest import mock
from json import dumps from json import dumps
from apprise import Apprise from apprise import Apprise
from apprise import plugins
import requests import requests
from helpers import AppriseURLTester from helpers import AppriseURLTester
@ -87,13 +86,11 @@ 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): mock_login, mock_sessions, no_throttling):
""" """
NotifyEmby General Tests NotifyEmby General Tests
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
req = requests.Request() req = requests.Request()
req.status_code = requests.codes.ok 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.get')
@mock.patch('requests.post') @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() NotifyEmby() login()
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare Mock # Prepare Mock
mock_get.return_value = requests.Request() 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('apprise.plugins.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()
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare Mock # Prepare Mock
mock_get.return_value = requests.Request() 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('apprise.plugins.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): def test_plugin_emby_logout(mock_post, mock_get, mock_login, no_throttling):
""" """
NotifyEmby() logout() NotifyEmby() logout()
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare Mock # Prepare Mock
mock_get.return_value = requests.Request() mock_get.return_value = requests.Request()

View File

@ -207,13 +207,11 @@ 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): def test_plugin_fcm_general_legacy(mock_post, no_throttling):
""" """
NotifyFCM() General Legacy/APIKey Checks NotifyFCM() General Legacy/APIKey Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare a good response # Prepare a good response
response = mock.Mock() response = mock.Mock()
@ -334,7 +332,7 @@ def test_plugin_fcm_general_legacy(mock_post):
@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): def test_plugin_fcm_general_oauth(mock_post, no_throttling):
""" """
NotifyFCM() General OAuth Checks NotifyFCM() General OAuth Checks
@ -343,9 +341,6 @@ def test_plugin_fcm_general_oauth(mock_post):
# Valid Keyfile # Valid Keyfile
path = os.path.join(PRIVATE_KEYFILE_DIR, 'service_account.json') 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 # Prepare a good response
response = mock.Mock() response = mock.Mock()
response.content = json.dumps({ response.content = json.dumps({
@ -853,13 +848,11 @@ 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): def test_plugin_fcm_edge_cases(mock_post, no_throttling):
""" """
NotifyFCM() Edge Cases NotifyFCM() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare a good response # Prepare a good response
response = mock.Mock() response = mock.Mock()

View File

@ -163,13 +163,11 @@ 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): def test_plugin_flock_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifyFlock() Edge Cases NotifyFlock() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initializes the plugin with an invalid token # Initializes the plugin with an invalid token
with pytest.raises(TypeError): with pytest.raises(TypeError):

View File

@ -114,13 +114,11 @@ 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): def test_plugin_gitter_general(mock_post, mock_get, no_throttling):
""" """
NotifyGitter() General Tests NotifyGitter() General Tests
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Generate a valid token (40 characters) # Generate a valid token (40 characters)
token = 'a' * 40 token = 'a' * 40

View File

@ -323,7 +323,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): def test_plugin_growl_config_files(mock_gntp, no_throttling):
""" """
NotifyGrowl() Config File Cases NotifyGrowl() Config File Cases
""" """
@ -350,9 +350,6 @@ def test_plugin_growl_config_files(mock_gntp):
tag: growl_str emerg tag: growl_str emerg
""" """
# Disable Throttling to speed testing
apprise.plugins.NotifyGrowl.request_rate_per_sec = 0
mock_notifier = mock.Mock() mock_notifier = mock.Mock()
mock_gntp.return_value = mock_notifier mock_gntp.return_value = mock_notifier
mock_notifier.notify.return_value = True mock_notifier.notify.return_value = True

View File

@ -145,13 +145,11 @@ def test_plugin_guilded_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_guilded_general(mock_post): def test_plugin_guilded_general(mock_post, no_throttling):
""" """
NotifyGuilded() General Checks NotifyGuilded() General Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
webhook_id = 'A' * 24 webhook_id = 'A' * 24

View File

@ -124,13 +124,11 @@ def test_plugin_homeassistant_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_homeassistant_general(mock_post): def test_plugin_homeassistant_general(mock_post, no_throttling):
""" """
NotifyHomeAssistant() General Checks NotifyHomeAssistant() General Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
response = mock.Mock() response = mock.Mock()
response.content = '' response.content = ''

View File

@ -111,13 +111,11 @@ 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): def test_plugin_ifttt_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifyIFTTT() Edge Cases NotifyIFTTT() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
webhook_id = 'webhook_id' webhook_id = 'webhook_id'
@ -135,9 +133,6 @@ def test_plugin_ifttt_edge_cases(mock_post, mock_get):
with pytest.raises(TypeError): with pytest.raises(TypeError):
plugins.NotifyIFTTT(webhook_id=None, events=None) 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 # Initializes the plugin with an invalid webhook id
with pytest.raises(TypeError): with pytest.raises(TypeError):
plugins.NotifyIFTTT(webhook_id=None, events=events) plugins.NotifyIFTTT(webhook_id=None, events=events)

View File

@ -129,13 +129,11 @@ 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): def test_plugin_join_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifyJoin() Edge Cases NotifyJoin() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Generate some generic message types # Generate some generic message types
device = 'A' * 32 device = 'A' * 32
@ -172,7 +170,7 @@ def test_plugin_join_edge_cases(mock_post, mock_get):
@mock.patch('requests.post') @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 NotifyJoin() Config File Cases
""" """
@ -199,9 +197,6 @@ def test_plugin_join_config_files(mock_post):
tag: join_str emerg tag: join_str emerg
""" % ('a' * 32, 'b' * 32, 'c' * 32, 'd' * 32) """ % ('a' * 32, 'b' * 32, 'c' * 32, 'd' * 32)
# Disable Throttling to speed testing
plugins.NotifyJoin.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

View File

@ -95,13 +95,11 @@ 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(): def test_plugin_kumulos_edge_cases(no_throttling):
""" """
NotifyKumulos() Edge Cases NotifyKumulos() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Invalid API Key # Invalid API Key
with pytest.raises(TypeError): with pytest.raises(TypeError):

View File

@ -176,13 +176,11 @@ def test_plugin_mailgun_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_mailgun_attachments(mock_post): def test_plugin_mailgun_attachments(mock_post, no_throttling):
""" """
NotifyMailgun() Attachments NotifyMailgun() Attachments
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
okay_response = requests.Request() okay_response = requests.Request()
okay_response.status_code = requests.codes.ok okay_response.status_code = requests.codes.ok

View File

@ -196,13 +196,11 @@ 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): def test_plugin_matrix_general(mock_post, mock_get, no_throttling):
""" """
NotifyMatrix() General Tests NotifyMatrix() General Tests
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
response_obj = { response_obj = {
'room_id': '!abc123:localhost', 'room_id': '!abc123:localhost',
@ -353,13 +351,11 @@ def test_plugin_matrix_general(mock_post, mock_get):
@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): def test_plugin_matrix_fetch(mock_post, mock_get, no_throttling):
""" """
NotifyMatrix() Server Fetch/API Tests NotifyMatrix() Server Fetch/API Tests
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
response_obj = { response_obj = {
'room_id': '!abc123:localhost', '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 # We would hve failed to send our notification
assert obj.send(user='test', password='passwd', body="test") is False 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 = { response_obj = {
# Registration # Registration
'access_token': 'abcd1234', 'access_token': 'abcd1234',
@ -460,13 +453,11 @@ def test_plugin_matrix_fetch(mock_post, mock_get):
@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): def test_plugin_matrix_auth(mock_post, mock_get, no_throttling):
""" """
NotifyMatrix() Server Authentication NotifyMatrix() Server Authentication
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
response_obj = { response_obj = {
# Registration # Registration
@ -556,13 +547,11 @@ def test_plugin_matrix_auth(mock_post, mock_get):
@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): def test_plugin_matrix_rooms(mock_post, mock_get, no_throttling):
""" """
NotifyMatrix() Room Testing NotifyMatrix() Room Testing
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
response_obj = { response_obj = {
# Registration # Registration

View File

@ -122,13 +122,11 @@ 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(): def test_plugin_mattermost_edge_cases(no_throttling):
""" """
NotifyMattermost() Edge Cases NotifyMattermost() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Invalid Authorization Token # Invalid Authorization Token
with pytest.raises(TypeError): with pytest.raises(TypeError):

View File

@ -103,13 +103,11 @@ def test_plugin_messagebird_urls():
@mock.patch('requests.post') @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 NotifyMessageBird() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -54,13 +54,11 @@ 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): def test_plugin_mqtt_general(mock_client, no_throttling):
""" """
NotifyMQTT() General Checks NotifyMQTT() General Checks
""" """
# Speed up request rate for testing
apprise.plugins.NotifyBase.request_rate_per_sec = 0
# our call to publish() response object # our call to publish() response object
publish_result = mock.Mock() publish_result = mock.Mock()

View File

@ -126,13 +126,11 @@ def test_plugin_msg91_urls():
@mock.patch('requests.post') @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 NotifyMSG91() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -176,13 +176,11 @@ def test_plugin_msteams_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_msteams_templating(mock_post, tmpdir): def test_plugin_msteams_templating(mock_post, tmpdir, no_throttling):
""" """
NotifyMSTeams() Templating NotifyMSTeams() Templating
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare Mock # Prepare Mock
mock_post.return_value = requests.Request() mock_post.return_value = requests.Request()
@ -387,15 +385,12 @@ def test_plugin_msteams_templating(mock_post, tmpdir):
@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): def test_msteams_yaml_config(mock_post, tmpdir, no_throttling):
""" """
NotifyMSTeams() YAML Configuration Entries NotifyMSTeams() YAML Configuration Entries
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.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

View File

@ -131,13 +131,11 @@ def test_plugin_nextcloud_urls():
@mock.patch('requests.post') @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 NotifyNextcloud() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# A response # A response
robj = mock.Mock() robj = mock.Mock()

View File

@ -121,13 +121,11 @@ def test_plugin_nextcloudtalk_urls():
@mock.patch('requests.post') @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 NotifyNextcloud() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# A response # A response
robj = mock.Mock() robj = mock.Mock()

View File

@ -234,13 +234,11 @@ def test_plugin_ntfy_chat_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_ntfy_attachments(mock_post): def test_plugin_ntfy_attachments(mock_post, no_throttling):
""" """
NotifyNtfy() Attachment Checks NotifyNtfy() Attachment Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyNtfy.request_rate_per_sec = 0
# Prepare Mock return object # Prepare Mock return object
response = mock.Mock() response = mock.Mock()
@ -351,13 +349,11 @@ def test_plugin_ntfy_attachments(mock_post):
@mock.patch('requests.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 NotifyNtfy() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()
@ -430,7 +426,7 @@ def test_plugin_custom_ntfy_edge_cases(mock_post):
@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): def test_plugin_ntfy_config_files(mock_post, mock_get, no_throttling):
""" """
NotifyNtfy() Config File Cases NotifyNtfy() Config File Cases
""" """
@ -459,9 +455,6 @@ def test_plugin_ntfy_config_files(mock_post, mock_get):
tag: ntfy_str max tag: ntfy_str max
""" """
# Disable Throttling to speed testing
plugins.NotifyNtfy.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

View File

@ -183,13 +183,11 @@ def test_plugin_office365_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_office365_general(mock_post): def test_plugin_office365_general(mock_post, no_throttling):
""" """
NotifyOffice365() General Testing NotifyOffice365() General Testing
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
email = 'user@example.net' email = 'user@example.net'
@ -301,13 +299,11 @@ def test_plugin_office365_general(mock_post):
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_office365_authentication(mock_post): def test_plugin_office365_authentication(mock_post, no_throttling):
""" """
NotifyOffice365() Authentication Testing NotifyOffice365() Authentication Testing
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
tenant = 'ff-gg-hh-ii-jj' tenant = 'ff-gg-hh-ii-jj'

View File

@ -192,13 +192,11 @@ def test_plugin_pushbullet_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_pushbullet_attachments(mock_post): def test_plugin_pushbullet_attachments(mock_post, no_throttling):
""" """
NotifyPushBullet() Attachment Checks NotifyPushBullet() Attachment Checks
""" """
# Disable Throttling to speed testing
plugins.NotifyPushBullet.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
access_token = 't' * 32 access_token = 't' * 32
@ -335,13 +333,11 @@ def test_plugin_pushbullet_attachments(mock_post):
@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): def test_plugin_pushbullet_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifyPushBullet() Edge Cases NotifyPushBullet() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Initialize some generic (but valid) tokens # Initialize some generic (but valid) tokens
accesstoken = 'a' * 32 accesstoken = 'a' * 32

View File

@ -145,13 +145,11 @@ 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): def test_plugin_pushed_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifyPushed() Edge Cases NotifyPushed() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Chat ID # Chat ID
recipients = '@ABCDEFG, @DEFGHIJ, #channel, #channel2' recipients = '@ABCDEFG, @DEFGHIJ, #channel, #channel2'

View File

@ -96,13 +96,11 @@ 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(): def test_plugin_pushjet_edge_cases(no_throttling):
""" """
NotifyPushjet() Edge Cases NotifyPushjet() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# No application Key specified # No application Key specified
with pytest.raises(TypeError): with pytest.raises(TypeError):

View File

@ -225,14 +225,12 @@ def test_plugin_reddit_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_reddit_general(mock_post): def test_plugin_reddit_general(mock_post, no_throttling):
""" """
NotifyReddit() General Tests NotifyReddit() General Tests
""" """
# Disable Throttling to speed testing NotifyReddit.clock_skew = timedelta(seconds=0)
plugins.NotifyBase.request_rate_per_sec = 0
plugins.NotifyReddit.clock_skew = timedelta(seconds=0)
# Generate a valid credentials: # Generate a valid credentials:
kwargs = { kwargs = {

View File

@ -228,13 +228,11 @@ 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): def test_plugin_rocketchat_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifyRocketChat() Edge Cases NotifyRocketChat() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Chat ID # Chat ID
recipients = 'AbcD1245, @l2g, @lead2gold, #channel, #channel2' recipients = 'AbcD1245, @l2g, @lead2gold, #channel, #channel2'

View File

@ -122,13 +122,11 @@ 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(): def test_plugin_ryver_edge_cases(no_throttling):
""" """
NotifyRyver() Edge Cases NotifyRyver() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# No token # No token
with pytest.raises(TypeError): with pytest.raises(TypeError):

View File

@ -126,13 +126,11 @@ 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): def test_plugin_sendgrid_edge_cases(mock_post, mock_get, no_throttling):
""" """
NotifySendGrid() Edge Cases NotifySendGrid() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# no apikey # no apikey
with pytest.raises(TypeError): with pytest.raises(TypeError):

View File

@ -154,13 +154,11 @@ def test_plugin_signal_urls():
@mock.patch('requests.post') @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 NotifySignalAPI() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()
@ -209,13 +207,11 @@ def test_plugin_signal_edge_cases(mock_post):
@mock.patch('requests.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 NotifySignalAPI() User Feedback Test
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()
@ -309,13 +305,11 @@ def test_plugin_signal_test_based_on_feedback(mock_post):
@mock.patch('requests.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 NotifySignalAPI() Attachments
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
okay_response = requests.Request() okay_response = requests.Request()
okay_response.status_code = requests.codes.ok okay_response.status_code = requests.codes.ok

View File

@ -130,13 +130,11 @@ 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(): def test_plugin_simplepush_edge_cases(no_throttling):
""" """
NotifySimplePush() Edge Cases NotifySimplePush() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# No token # No token
with pytest.raises(TypeError): with pytest.raises(TypeError):
@ -156,12 +154,10 @@ def test_plugin_simplepush_edge_cases():
@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): def test_plugin_simplepush_general(mock_post, no_throttling):
""" """
NotifySimplePush() General Tests NotifySimplePush() General Tests
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare a good response # Prepare a good response
response = mock.Mock() response = mock.Mock()

View File

@ -133,13 +133,11 @@ def test_plugin_sinch_urls():
@mock.patch('requests.post') @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 NotifySinch() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -269,13 +269,11 @@ def test_plugin_smseagle_urls():
@mock.patch('requests.post') @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 NotifySMSEagle() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()
@ -321,13 +319,11 @@ def test_plugin_smseagle_edge_cases(mock_post):
@mock.patch('requests.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 NotifySMSEagle() Result Sets
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()
@ -539,13 +535,11 @@ def test_plugin_smseagle_result_set(mock_post):
@mock.patch('requests.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 NotifySMSEagle() Result List Response
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
okay_response = requests.Request() okay_response = requests.Request()
okay_response.status_code = requests.codes.ok okay_response.status_code = requests.codes.ok
@ -583,13 +577,11 @@ def test_notify_smseagle_plugin_result_list(mock_post):
@mock.patch('requests.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 NotifySMSEagle() Attachments
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
okay_response = requests.Request() okay_response = requests.Request()
okay_response.status_code = requests.codes.ok okay_response.status_code = requests.codes.ok

View File

@ -155,13 +155,11 @@ def test_plugin_smtp2go_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_smtp2go_attachments(mock_post): def test_plugin_smtp2go_attachments(mock_post, no_throttling):
""" """
NotifySMTP2Go() Attachments NotifySMTP2Go() Attachments
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
okay_response = requests.Request() okay_response = requests.Request()
okay_response.status_code = requests.codes.ok okay_response.status_code = requests.codes.ok

View File

@ -263,14 +263,12 @@ def test_plugin_sparkpost_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_sparkpost_throttling(mock_post): def test_plugin_sparkpost_throttling(mock_post, no_throttling):
""" """
NotifySparkPost() 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_wait_sec = 0.1
plugins.NotifySparkPost.sparkpost_retry_attempts = 3 plugins.NotifySparkPost.sparkpost_retry_attempts = 3
@ -334,13 +332,11 @@ def test_plugin_sparkpost_throttling(mock_post):
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_sparkpost_attachments(mock_post): def test_plugin_sparkpost_attachments(mock_post, no_throttling):
""" """
NotifySparkPost() Attachments 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_wait_sec = 0.1
plugins.NotifySparkPost.sparkpost_retry_attempts = 3 plugins.NotifySparkPost.sparkpost_retry_attempts = 3

View File

@ -128,15 +128,13 @@ def test_plugin_twilio_urls():
@mock.patch('requests.post') @mock.patch('requests.post')
def test_plugin_twilio_auth(mock_post): def test_plugin_twilio_auth(mock_post, no_throttling):
""" """
NotifyTwilio() Auth NotifyTwilio() Auth
- account-wide auth token - account-wide auth token
- API key and its own 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 = mock.Mock()
response.content = '' response.content = ''
@ -199,13 +197,11 @@ def test_plugin_twilio_auth(mock_post):
@mock.patch('requests.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 NotifyTwilio() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -164,13 +164,11 @@ 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): def test_plugin_twist_auth(mock_post, mock_get, no_throttling):
""" """
NotifyTwist() login/logout() NotifyTwist() login/logout()
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare Mock # Prepare Mock
mock_get.return_value = requests.Request() 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.get')
@mock.patch('requests.post') @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 NotifyTwist() Cache Handling
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
def _response(url, *args, **kwargs): 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.get')
@mock.patch('requests.post') @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() NotifyTwist() fetch()
@ -364,8 +360,6 @@ def test_plugin_twist_fetch(mock_post, mock_get):
happens to expire. This tests these edge cases 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 # Track our iteration; by tracing within an object, we can re-reference
# it within a function scope. # it within a function scope.

View File

@ -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): def test_plugin_twitter_general(mock_post, mock_get, no_throttling):
""" """
NotifyTwitter() General Tests NotifyTwitter() General Tests
@ -228,9 +228,6 @@ def test_plugin_twitter_general(mock_post, mock_get):
'id': 9876, 'id': 9876,
}] }]
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Epoch time: # Epoch time:
epoch = datetime.utcfromtimestamp(0) epoch = datetime.utcfromtimestamp(0)
@ -423,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): def test_plugin_twitter_dm_attachments(mock_get, mock_post, no_throttling):
""" """
NotifyTwitter() DM Attachment Checks NotifyTwitter() DM Attachment Checks
@ -439,9 +436,6 @@ def test_plugin_twitter_dm_attachments(mock_get, mock_post):
'id': 9876, 'id': 9876,
} }
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare a good DM response # Prepare a good DM response
good_dm_response = mock.Mock() good_dm_response = mock.Mock()
good_dm_response.content = dumps(good_dm_response_obj) 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.post')
@mock.patch('requests.get') @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 NotifyTwitter() Tweet Attachment Checks
@ -658,9 +652,6 @@ def test_plugin_twitter_tweet_attachments(mock_get, mock_post):
'id': 9876, 'id': 9876,
} }
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare a good DM response # Prepare a good DM response
good_tweet_response = mock.Mock() good_tweet_response = mock.Mock()
good_tweet_response.content = dumps(good_tweet_response_obj) good_tweet_response.content = dumps(good_tweet_response_obj)

View File

@ -180,13 +180,11 @@ def test_plugin_vonage_urls():
@mock.patch('requests.post') @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 NotifyVonage() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Prepare our response # Prepare our response
response = requests.Request() response = requests.Request()

View File

@ -120,13 +120,11 @@ 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(): def test_plugin_zulip_edge_cases(no_throttling):
""" """
NotifyZulip() Edge Cases NotifyZulip() Edge Cases
""" """
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# must be 32 characters long # must be 32 characters long
token = 'a' * 32 token = 'a' * 32

View File

@ -28,7 +28,6 @@ from random import choice
from string import ascii_uppercase as str_alpha from string import ascii_uppercase as str_alpha
from string import digits as str_num from string import digits as str_num
from apprise import plugins
from apprise import NotifyBase from apprise import NotifyBase
from apprise.common import NotifyFormat from apprise.common import NotifyFormat
from apprise.common import OverflowMode from apprise.common import OverflowMode
@ -38,7 +37,7 @@ import logging
logging.disable(logging.CRITICAL) logging.disable(logging.CRITICAL)
def test_notify_overflow_truncate(): def test_notify_overflow_truncate(no_throttling):
""" """
API: Overflow Truncate Functionality Testing API: Overflow Truncate Functionality Testing
@ -47,9 +46,6 @@ def test_notify_overflow_truncate():
# A little preparation # A little preparation
# #
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Number of characters per line # Number of characters per line
row = 24 row = 24
@ -210,7 +206,7 @@ def test_notify_overflow_truncate():
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(): def test_notify_overflow_split(no_throttling):
""" """
API: Overflow Split Functionality Testing API: Overflow Split Functionality Testing
@ -220,9 +216,6 @@ def test_notify_overflow_split():
# A little preparation # A little preparation
# #
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Number of characters per line # Number of characters per line
row = 24 row = 24
@ -386,7 +379,7 @@ def test_notify_overflow_split():
offset += len(_body) offset += len(_body)
def test_notify_overflow_general(): def test_notify_overflow_general(no_throttling):
""" """
API: Overflow General Testing API: Overflow General Testing
@ -396,9 +389,6 @@ def test_notify_overflow_general():
# A little preparation # A little preparation
# #
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# #
# First Test: Truncated Title # First Test: Truncated Title
# #