Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jpush-api-python-client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
jpush-api-python-client
Commits
f0a70670
Commit
f0a70670
authored
Aug 22, 2014
by
hupantingxue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. Add message test cases;
2. Update payload;
parent
3689ee0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
payload.py
jpush/push/payload.py
+1
-1
test_message.py
tests/push/test_message.py
+25
-0
No files found.
jpush/push/payload.py
View file @
f0a70670
...
...
@@ -94,7 +94,7 @@ def winphone(alert, title=None, _open_page=None, extras=None):
Must include exactly one of ``alert``, ``title``, ``_open_page``, or ``extras``.
"""
if
len
(
filter
(
None
,
(
alert
,
toast
,
ti
le
)))
!=
1
:
if
len
(
filter
(
None
,
(
alert
,
_open_page
,
tit
le
)))
!=
1
:
raise
ValueError
(
"MPNS payload must have one notification type."
)
payload
=
{}
if
alert
is
not
None
:
...
...
tests/push/test_message.py
0 → 100644
View file @
f0a70670
import
unittest
import
jpush
as
jpush
class
TestMessage
(
unittest
.
TestCase
):
def
test_simple_alert
(
self
):
self
.
assertEqual
(
jpush
.
notification
(
alert
=
'Hello'
),
{
'alert'
:
'Hello'
})
def
test_ios
(
self
):
self
.
assertEqual
(
jpush
.
notification
(
ios
=
jpush
.
ios
(
alert
=
"Hello"
,
badge
=
"+1"
,
sound
=
"a.caf"
,
extras
=
{
'k1'
:
'v1'
})),
{
'ios'
:
{
'sound'
:
'a.caf'
,
'extras'
:
{
'k1'
:
'v1'
},
'badge'
:
'+1'
,
'alert'
:
'Hello'
}}
)
def
test_android
(
self
):
self
.
assertEqual
(
jpush
.
notification
(
android
=
jpush
.
android
(
alert
=
"Hello"
,
extras
=
{
'k2'
:
'v2'
})),
{
'android'
:
{
'extras'
:
{
'k2'
:
'v2'
},
'alert'
:
'Hello'
}}
)
def
test_winphone
(
self
):
self
.
assertEqual
(
jpush
.
notification
(
winphone
=
jpush
.
winphone
(
alert
=
"Hello"
,
extras
=
{
'k3'
:
'v3'
})),
{
'winphone'
:
{
'extras'
:
{
'k3'
:
'v3'
},
'alert'
:
'Hello'
}}
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment