Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
feat: temporarily allow aps data via registration message
Browse files Browse the repository at this point in the history
closes #887
  • Loading branch information
jrconlin committed May 5, 2017
1 parent c7e6c47 commit 4d60b07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autopush/router/apnsrouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _route(self, notification, router_data):
payload["cryptokey"] = notification.headers["crypto_key"]
elif "encryption_key" in notification.headers:
payload["enckey"] = notification.headers["encryption_key"]
payload['aps'] = {"content-available": 1}
payload['aps'] = router_data.get('aps', {"content-available": 1})
apns_id = str(uuid.uuid4()).lower()
try:
apns_client.send(router_token=router_token, payload=payload,
Expand Down
8 changes: 8 additions & 0 deletions autopush/tests/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ def test_register(self):
self.router.register("uaid", router_data=router_data, app_id="firefox")
eq_(router_data, {"rel_channel": "firefox", "token": "connect_data"})

def test_extended_register(self):
router_data = {"token": "connect_data",
"aps": {"foo": "bar",
"gorp": "baz"}}
self.router.register("uaid", router_data=router_data, app_id="firefox")
eq_(router_data, {"rel_channel": "firefox", "token": "connect_data",
"aps": {"foo": "bar", "gorp": "baz"}})

def test_register_bad(self):
with assert_raises(RouterException):
self.router.register("uaid", router_data={}, app_id="firefox")
Expand Down

0 comments on commit 4d60b07

Please sign in to comment.