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
df5d7020
Commit
df5d7020
authored
May 13, 2016
by
fendouai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Test Audience
parent
63947740
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
test_audience.py
tests/push/test_audience.py
+29
-0
test_message.py
tests/push/test_message.py
+1
-1
No files found.
tests/push/test_audience.py
View file @
df5d7020
import
unittest
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
jpush
import
common
class
TestAudience
(
unittest
.
TestCase
):
...
...
@@ -13,3 +15,30 @@ class TestAudience(unittest.TestCase):
)
for
selector
,
value
,
result
in
selectors
:
self
.
assertEqual
(
selector
(
value
),
result
)
def
test_audience
(
self
):
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
audience
(
jpush
.
tag
(
"tag1"
,
"tag2"
),
jpush
.
alias
(
"alias1"
,
"alias2"
)
)
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello world with audience!"
)
push
.
platform
=
jpush
.
all_
try
:
response
=
push
.
send
()
print
response
.
status_code
self
.
assertEqual
(
response
.
status_code
,
200
)
except
common
.
Unauthorized
,
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
Unauthorized
))
raise
common
.
Unauthorized
(
"Unauthorized"
)
except
common
.
APIConnectionException
,
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
APIConnectionException
))
raise
common
.
APIConnectionException
(
"conn"
)
except
common
.
JPushFailure
,
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
JPushFailure
))
print
"JPushFailure"
except
:
self
.
assertFalse
(
1
)
print
"Exception"
tests/push/test_message.py
View file @
df5d7020
...
...
@@ -54,5 +54,5 @@ class TestMessage(unittest.TestCase):
self
.
assertFalse
(
isinstance
(
e
,
common
.
JPushFailure
))
print
"JPushFailure"
except
:
self
.
self
.
assertFalse
(
1
)
self
.
assertFalse
(
1
)
print
"Exception"
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