Tests: Use no_throttling fixture everywhere

This commit is contained in:
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

@ -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()