Skip to content

Commit e0e098c

Browse files
committed
Add test for mutable_content in apns_async
1 parent df472da commit e0e098c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_apns_async_push_payload.py

+19
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,25 @@ def test_aioapns_err_func(self, mock_cert_pool):
181181
mock.ANY, result
182182
)
183183

184+
@mock.patch("push_notifications.apns_async.APNs", autospec=True)
185+
def test_push_payload_with_mutable_content(self, mock_apns):
186+
apns_send_message(
187+
"123",
188+
"Hello world",
189+
mutable_content=True,
190+
creds=TokenCredentials(key="aaa", key_id="bbb", team_id="ccc"),
191+
sound="chime",
192+
extra={"custom_data": 12345},
193+
expiration=int(time.time()) + 3,
194+
)
195+
196+
args, kwargs = mock_apns.return_value.send_notification.call_args
197+
req = args[0]
198+
199+
# Assertions
200+
self.assertTrue("mutable-content" in req.message["aps"])
201+
self.assertEqual(req.message["aps"]["mutable-content"], 1) # APNs expects 1 for True
202+
184203
# def test_bad_priority(self):
185204
# with mock.patch("apns2.credentials.init_context"):
186205
# with mock.patch("apns2.client.APNsClient.connect"):

0 commit comments

Comments
 (0)