mirror of https://github.com/caronc/apprise
bugfix - Office 365 include subject and body now (#1274)
parent
a2a2216c46
commit
fcc4939328
|
@ -366,15 +366,13 @@ class NotifyOffice365(NotifyBase):
|
||||||
|
|
||||||
if self.from_email:
|
if self.from_email:
|
||||||
# Apply from email if it is known
|
# Apply from email if it is known
|
||||||
payload.update({
|
payload['message'].update({
|
||||||
'message': {
|
'from': {
|
||||||
'from': {
|
"emailAddress": {
|
||||||
"emailAddress": {
|
"address": self.from_email,
|
||||||
"address": self.from_email,
|
"name": self.from_name or self.app_id,
|
||||||
"name": self.from_name or self.app_id,
|
}
|
||||||
}
|
},
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# Create a copy of the email list
|
# Create a copy of the email list
|
||||||
|
|
|
@ -32,7 +32,7 @@ from unittest import mock
|
||||||
import pytest
|
import pytest
|
||||||
import requests
|
import requests
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from json import dumps
|
from json import dumps, loads
|
||||||
from apprise import Apprise
|
from apprise import Apprise
|
||||||
from apprise import NotifyType
|
from apprise import NotifyType
|
||||||
from apprise import AppriseAttachment
|
from apprise import AppriseAttachment
|
||||||
|
@ -541,6 +541,18 @@ def test_plugin_office365_queries(mock_post, mock_get, mock_put):
|
||||||
'https://login.microsoftonline.com/{}/oauth2/v2.0/token'.format(tenant)
|
'https://login.microsoftonline.com/{}/oauth2/v2.0/token'.format(tenant)
|
||||||
assert mock_post.call_args_list[1][0][0] == \
|
assert mock_post.call_args_list[1][0][0] == \
|
||||||
'https://graph.microsoft.com/v1.0/users/abc-1234-object-id/sendMail'
|
'https://graph.microsoft.com/v1.0/users/abc-1234-object-id/sendMail'
|
||||||
|
payload = loads(mock_post.call_args_list[1][1]['data'])
|
||||||
|
assert payload == {
|
||||||
|
'message': {
|
||||||
|
'subject': 'title',
|
||||||
|
'body': {
|
||||||
|
'contentType': 'HTML',
|
||||||
|
'content': 'body',
|
||||||
|
},
|
||||||
|
'toRecipients': [
|
||||||
|
{'emailAddress': {'address': 'target@example.ca'}}]},
|
||||||
|
'saveToSentItems': 'true',
|
||||||
|
}
|
||||||
mock_post.reset_mock()
|
mock_post.reset_mock()
|
||||||
|
|
||||||
# Now test a case where we just couldn't get any email details from the
|
# Now test a case where we just couldn't get any email details from the
|
||||||
|
|
Loading…
Reference in New Issue