-
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SparkPost cc and bcc improvements + test cases (#309)
- Loading branch information
Showing
2 changed files
with
41 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ | |
@mock.patch('requests.post') | ||
def test_notify_sparkpost_plugin_throttling(mock_post): | ||
""" | ||
API: NotifySpark() Throttling | ||
API: NotifySparkPost() Throttling | ||
""" | ||
|
||
|
@@ -115,7 +115,7 @@ def test_notify_sparkpost_plugin_throttling(mock_post): | |
@mock.patch('requests.post') | ||
def test_notify_sparkpost_plugin_attachments(mock_post): | ||
""" | ||
API: NotifySpark() Attachments | ||
API: NotifySparkPost() Attachments | ||
""" | ||
# Disable Throttling to speed testing | ||
|
@@ -161,3 +161,28 @@ def test_notify_sparkpost_plugin_attachments(mock_post): | |
assert obj.notify( | ||
body='body', title='title', notify_type=NotifyType.INFO, | ||
attach=attach) is False | ||
|
||
obj = Apprise.instantiate( | ||
'sparkpost://[email protected]/{}/' | ||
'[email protected]/[email protected]?batch=yes'.format(apikey)) | ||
assert isinstance(obj, plugins.NotifySparkPost) | ||
|
||
# Force our batch to break into separate messages | ||
obj.default_batch_size = 1 | ||
# We'll send 2 messages | ||
mock_post.reset_mock() | ||
|
||
assert obj.notify( | ||
body='body', title='title', notify_type=NotifyType.INFO, | ||
attach=attach) is True | ||
assert mock_post.call_count == 2 | ||
|
||
# single batch | ||
mock_post.reset_mock() | ||
# We'll send 1 message | ||
obj.default_batch_size = 2 | ||
|
||
assert obj.notify( | ||
body='body', title='title', notify_type=NotifyType.INFO, | ||
attach=attach) is True | ||
assert mock_post.call_count == 1 |