-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support 'attach' keyword (alias of 'attachment')
- Loading branch information
Showing
3 changed files
with
121 additions
and
7 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 |
---|---|---|
|
@@ -250,6 +250,50 @@ def test_partial_notify(self, mock_notify): | |
assert response.status_code == 400 | ||
assert mock_notify.call_count == 0 | ||
|
||
# Reset our mock object | ||
mock_notify.reset_mock() | ||
|
||
# Preare our form data (support attach keyword) | ||
form_data = { | ||
'body': 'test notifiction', | ||
'urls': ', '.join([ | ||
'mailto://user:[email protected]', | ||
'mailto://user:[email protected]', | ||
]), | ||
'attach': 'https://localhost/invalid/path/to/image.png', | ||
} | ||
|
||
# Send our notification | ||
response = self.client.post('/notify', form_data) | ||
# We fail because we couldn't retrieve our attachment | ||
assert response.status_code == 400 | ||
assert mock_notify.call_count == 0 | ||
|
||
# Reset our mock object | ||
mock_notify.reset_mock() | ||
|
||
# Preare our json data (and support attach keyword as alias) | ||
json_data = { | ||
'body': 'test notifiction', | ||
'urls': ', '.join([ | ||
'mailto://user:[email protected]', | ||
'mailto://user:[email protected]', | ||
]), | ||
'attach': 'https://localhost/invalid/path/to/image.png', | ||
} | ||
|
||
# Same results | ||
response = self.client.post( | ||
'/notify/', | ||
data=json.dumps(json_data), | ||
content_type='application/json', | ||
) | ||
|
||
# We fail because we couldn't retrieve our attachment | ||
assert response.status_code == 400 | ||
assert mock_notify.call_count == 0 | ||
|
||
|
||
@override_settings(APPRISE_RECURSION_MAX=1) | ||
@mock.patch('apprise.Apprise.notify') | ||
def test_stateless_notify_recursion(self, mock_notify): | ||
|
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