Commit 5e882ac2 authored by fendouai's avatar fendouai

add test post schedule periodical

parent 973d49ab
...@@ -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-05-17 12:00:00") trigger=jpush.schedulepayload.trigger("2016-07-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
...@@ -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-05-17 12:00:00") trigger = jpush.schedulepayload.trigger("2016-07-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-05-17 12:00:00") trigger = jpush.schedulepayload.trigger("2016-07-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-05-17 12:00:00") trigger = jpush.schedulepayload.trigger("2016-07-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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment