-
-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test case to test verify complex mailto:// parsing (#991)
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1584,3 +1584,38 @@ def test_plugin_email_plus_in_toemail(mock_smtp, mock_smtp_ssl): | |
assert len(_to) == 1 | ||
assert _to[0] == '[email protected]' | ||
assert _msg.split('\n')[-3] == 'test' | ||
|
||
|
||
@mock.patch('smtplib.SMTP_SSL') | ||
@mock.patch('smtplib.SMTP') | ||
def test_plugin_email_formatting_990(mock_smtp, mock_smtp_ssl): | ||
""" | ||
NotifyEmail() GitHub Issue 990 | ||
https://github.com/caronc/apprise/issues/990 | ||
Email formatting not working correctly | ||
""" | ||
|
||
response = mock.Mock() | ||
mock_smtp_ssl.return_value = response | ||
mock_smtp.return_value = response | ||
|
||
results = NotifyEmail.parse_url( | ||
'mailtos://mydomain.com?smtp=mail.local.mydomain.com' | ||
'&[email protected]&pass=mypassword' | ||
'&[email protected]&[email protected]&mode=ssl&port=465') | ||
|
||
assert isinstance(results, dict) | ||
assert '[email protected]' == results['user'] | ||
assert 'mydomain.com' == results['host'] | ||
assert 'mail.local.mydomain.com' == results['smtp_host'] | ||
assert 'mypassword' == results['password'] | ||
assert 'ssl' == results['secure_mode'] | ||
assert '465' == results['port'] | ||
assert '[email protected]' in results['targets'] | ||
|
||
obj = Apprise.instantiate(results, suppress_exceptions=False) | ||
assert isinstance(obj, NotifyEmail) is True | ||
|
||
assert len(obj.targets) == 1 | ||
assert (False, '[email protected]') in obj.targets |