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
5e882ac2
Commit
5e882ac2
authored
May 18, 2016
by
fendouai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test post schedule periodical
parent
973d49ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
example_post_schedule.py
examples/schedule_examples/example_post_schedule.py
+1
-1
test_schedule.py
tests/schedule/test_schedule.py
+10
-3
No files found.
examples/schedule_examples/example_post_schedule.py
View file @
5e882ac2
...
@@ -10,7 +10,7 @@ push.notification = jpush.notification(alert="Hello, world!")
...
@@ -10,7 +10,7 @@ push.notification = jpush.notification(alert="Hello, world!")
push
.
platform
=
jpush
.
all_
push
.
platform
=
jpush
.
all_
push
=
push
.
payload
push
=
push
.
payload
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
5
-17 12:00:00"
)
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
7
-17 12:00:00"
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"name"
,
True
,
trigger
,
push
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"name"
,
True
,
trigger
,
push
)
result
=
schedule
.
post_schedule
(
schedulepayload
)
result
=
schedule
.
post_schedule
(
schedulepayload
)
print
result
.
status_code
print
result
.
status_code
tests/schedule/test_schedule.py
View file @
5e882ac2
...
@@ -17,11 +17,18 @@ push=push.payload
...
@@ -17,11 +17,18 @@ push=push.payload
class
TestEntity
(
unittest
.
TestCase
):
class
TestEntity
(
unittest
.
TestCase
):
def
test_post_schedule
(
self
):
def
test_post_schedule
(
self
):
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
5
-17 12:00:00"
)
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
7
-17 12:00:00"
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"name"
,
True
,
trigger
,
push
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"name"
,
True
,
trigger
,
push
)
result
=
schedule
.
post_schedule
(
schedulepayload
)
result
=
schedule
.
post_schedule
(
schedulepayload
)
self
.
assertEqual
(
result
.
status_code
,
200
)
self
.
assertEqual
(
result
.
status_code
,
200
)
def
test_post_schedule_periodical
(
self
):
trigger
=
jpush
.
schedulepayload
.
trigger
(
"12:00:00"
,
start
=
"2016-07-17 12:00:00"
,
end
=
"2016-09-17 12:00:00"
,
time_unit
=
"WEEK"
,
frequency
=
1
,
point
=
[
"WED"
,
"FRI"
])
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"periodical"
,
True
,
trigger
,
push
)
result
=
schedule
.
post_schedule
(
schedulepayload
)
self
.
assertEqual
(
result
.
status_code
,
200
)
def
test_get_schedule_by_id
(
self
):
def
test_get_schedule_by_id
(
self
):
result
=
schedule
.
get_schedule_by_id
(
"3fc6e2fa-15a6-11e6-83d4-0021f653c902"
)
result
=
schedule
.
get_schedule_by_id
(
"3fc6e2fa-15a6-11e6-83d4-0021f653c902"
)
self
.
assertEqual
(
result
.
status_code
,
200
)
self
.
assertEqual
(
result
.
status_code
,
200
)
...
@@ -42,7 +49,7 @@ class TestEntity(unittest.TestCase):
...
@@ -42,7 +49,7 @@ class TestEntity(unittest.TestCase):
pass
pass
def
test_put_invalid_schedule
(
self
):
def
test_put_invalid_schedule
(
self
):
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
5
-17 12:00:00"
)
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
7
-17 12:00:00"
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"update a new name"
,
True
,
trigger
,
push
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"update a new name"
,
True
,
trigger
,
push
)
try
:
try
:
result
=
schedule
.
put_schedule
(
schedulepayload
,
"3fc6e2fa-15a6-11e6-83d4-0021f653c902"
)
result
=
schedule
.
put_schedule
(
schedulepayload
,
"3fc6e2fa-15a6-11e6-83d4-0021f653c902"
)
...
@@ -51,7 +58,7 @@ class TestEntity(unittest.TestCase):
...
@@ -51,7 +58,7 @@ class TestEntity(unittest.TestCase):
pass
pass
def
test_put_schedule
(
self
):
def
test_put_schedule
(
self
):
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
5
-17 12:00:00"
)
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-0
7
-17 12:00:00"
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"update_a_new_name"
,
True
,
trigger
,
push
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"update_a_new_name"
,
True
,
trigger
,
push
)
try
:
try
:
result
=
schedule
.
put_schedule
(
schedulepayload
,
"3fc6e2fa-15a6-11e6-83d4-0021f653c902"
)
result
=
schedule
.
put_schedule
(
schedulepayload
,
"3fc6e2fa-15a6-11e6-83d4-0021f653c902"
)
...
...
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