Skip to content

Commit

Permalink
Fix payload key assigments for "title-loc", "title-loc-args", and "la…
Browse files Browse the repository at this point in the history
…unch-image". Previously, "_" was used in place of "-".
  • Loading branch information
dgilland committed Mar 30, 2015
1 parent a50e448 commit 1e10fd4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
=========


- Fix payload key assigments for ``title-loc``, ``title-loc-args``, and ``launch-image``. Previously, ``'_'`` was used in place of ``'-'``.


v0.2.1 (2015-03-28)
-------------------

Expand Down
6 changes: 3 additions & 3 deletions pushjack/apns.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def create_payload(alert,
alert['title'] = title

if title_loc_key:
alert['title_loc_key'] = title_loc_key
alert['title-loc-key'] = title_loc_key

if title_loc_args:
alert['title_loc_args'] = title_loc_args
alert['title-loc-args'] = title_loc_args

if action_loc_key:
alert['action-loc-key'] = action_loc_key
Expand All @@ -95,7 +95,7 @@ def create_payload(alert,
alert['loc-args'] = loc_args

if launch_image:
alert['launch_image'] = launch_image
alert['launch-image'] = launch_image

if alert:
payload['aps']['alert'] = alert
Expand Down
12 changes: 6 additions & 6 deletions tests/test_apns.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
'expiration': 3},
(json_dumps({'aps': {'alert': {'body': 'Hello world',
'title': 'title',
'title_loc_key': 'tlk',
'title_loc_args': 'tla',
'launch_image': 'image'}}}),
'title-loc-key': 'tlk',
'title-loc-args': 'tla',
'launch-image': 'image'}}}),
0, 3, 10)),
])
def test_apns_send(apns, apns_sock, token, alert, extra, expected):
Expand Down Expand Up @@ -123,9 +123,9 @@ def test_apns_send(apns, apns_sock, token, alert, extra, expected):
'expiration': 3},
(json_dumps({'aps': {'alert': {'body': 'Hello world',
'title': 'title',
'title_loc_key': 'tlk',
'title_loc_args': 'tla',
'launch_image': 'image'}}}),
'title-loc-key': 'tlk',
'title-loc-args': 'tla',
'launch-image': 'image'}}}),
0, 3, 10)),
])
def test_apns_send_bulk(apns, apns_sock, tokens, alert, extra, expected):
Expand Down

0 comments on commit 1e10fd4

Please sign in to comment.