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
fc8ac49d
Commit
fc8ac49d
authored
May 10, 2016
by
fendouai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add status code to report api ,add report test
parent
46f63eb4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
+37
-2
core.py
jpush/report/core.py
+6
-1
test_message.py
tests/push/test_message.py
+1
-1
test_report.py
tests/report/test_report.py
+30
-0
No files found.
jpush/report/core.py
View file @
fc8ac49d
...
...
@@ -11,7 +11,6 @@ class Report(object):
def
__init__
(
self
,
jpush
):
self
.
_jpush
=
jpush
def
send
(
self
,
method
,
url
,
body
,
content_type
=
None
,
version
=
3
):
"""Send the request
...
...
@@ -51,13 +50,18 @@ class ReportResponse(object):
"""
payload
=
None
status_code
=
None
def
__init__
(
self
,
response
):
self
.
status_code
=
response
.
status_code
if
0
!=
len
(
response
.
content
):
data
=
response
.
json
()
self
.
payload
=
data
elif
200
==
response
.
status_code
:
self
.
payload
=
"success"
def
get_status_code
(
self
):
return
self
.
status_code
def
__str__
(
self
):
return
"Report response Payload: {0}"
.
format
(
self
.
payload
)
\ No newline at end of file
tests/push/test_message.py
View file @
fc8ac49d
#-*- coding:utf-8 -*-
#
-*- coding:utf-8 -*-
import
unittest
import
jpush
as
jpush
...
...
tests/report/test_report.py
0 → 100644
View file @
fc8ac49d
import
unittest
from
jpush
import
schedule
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
jpush
import
common
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
schedule
=
_jpush
.
create_schedule
()
_jpush
.
set_logging
(
"DEBUG"
)
report
=
_jpush
.
create_report
();
class
TestEntity
(
unittest
.
TestCase
):
def
test_messages
(
self
):
result
=
report
.
get_messages
(
"3289406737"
)
self
.
assertEqual
(
result
.
status_code
,
200
)
def
test_get_schedule_by_id
(
self
):
result
=
report
.
get_received
(
"3289406737"
)
self
.
assertEqual
(
result
.
status_code
,
200
)
def
test_get_schedule_by_invalid_id
(
self
):
try
:
result
=
report
.
get_users
(
"DAY"
,
"2016-04-10"
,
"3"
)
self
.
assertEqual
(
result
.
status_code
,
200
)
except
common
.
JPushFailure
,
e
:
print
e
self
.
assertIsInstance
(
e
,
common
.
JPushFailure
)
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