MCPcopy Index your code
hub / github.com/O365/python-o365 / test_to_api_data

Method test_to_api_data

tests/test_message.py:104–135  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

102 assert msg.get_body_text() == "content"
103
104 def test_to_api_data(self):
105 msg = message(
106 __cloud_data__={
107 "id": "123",
108 "isDraft": False,
109 "body": {"content": "<html><body>"},
110 }
111 )
112 msg.to.add("alice@example.com")
113 msg.cc.add("alice@example.com")
114 msg.bcc.add("alice@example.com")
115 msg.reply_to.add("alice@example.com")
116 msg.sender = "alice@example.com"
117 assert msg.to_api_data() == {
118 "body": {"content": "<html><body>", "contentType": "HTML"},
119 "conversationId": None,
120 "flag": {"flagStatus": "notFlagged"},
121 "hasAttachments": False,
122 "id": "123",
123 "importance": "normal",
124 "isDeliveryReceiptRequested": False,
125 "isDraft": False,
126 "isRead": None,
127 "isReadReceiptRequested": False,
128 "subject": "",
129 "parentFolderId": None,
130 "from": {"emailAddress": {"address": "alice@example.com"}},
131 "toRecipients": [{"emailAddress": {"address": "alice@example.com"}}],
132 "bccRecipients": [{"emailAddress": {"address": "alice@example.com"}}],
133 "ccRecipients": [{"emailAddress": {"address": "alice@example.com"}}],
134 "replyTo": [{"emailAddress": {"address": "alice@example.com"}}],
135 }
136
137
138class TestMessageApiCalls:

Callers

nothing calls this directly

Calls 3

messageFunction · 0.85
addMethod · 0.45
to_api_dataMethod · 0.45

Tested by

no test coverage detected