From 1e10fd4fb186882fe69fda3c06bc15ea210d0991 Mon Sep 17 00:00:00 2001 From: Derrick Gilland Date: Mon, 30 Mar 2015 11:36:26 -0400 Subject: [PATCH] Fix payload key assigments for "title-loc", "title-loc-args", and "launch-image". Previously, "_" was used in place of "-". --- CHANGES.rst | 3 +++ pushjack/apns.py | 6 +++--- tests/test_apns.py | 12 ++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 79aecf9..382a285 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) ------------------- diff --git a/pushjack/apns.py b/pushjack/apns.py index 02098ff..5f331b8 100644 --- a/pushjack/apns.py +++ b/pushjack/apns.py @@ -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 @@ -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 diff --git a/tests/test_apns.py b/tests/test_apns.py index 9a46a60..3f17754 100644 --- a/tests/test_apns.py +++ b/tests/test_apns.py @@ -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): @@ -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):