Commit c61a0d02 authored by wuliang's avatar wuliang

Remove useless files;

parent 7dcabe17
import unittest
import sys
sys.path.append('../..')
import jpush as jpush
class TestAudience(unittest.TestCase):
def test_basic_selectors(self):
selectors = (
(jpush.tag, 'test', {'tag': 'test'}),
(jpush.tag_and, 'test', {'tag_and': 'test'}),
(jpush.alias, 'test', {'alias': 'test'}),
(jpush.registration_id, 'test', {'registration_id': 'test'}),
)
for selector, value, result in selectors:
self.assertEqual(selector(value), result)
import unittest
import sys
sys.path.append('../..')
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='cat.caf',
extra={'more': 'stuff'}
)),
{'ios': {
'alert': 'Hello',
'badge': '+1',
'sound': 'cat.caf',
'extra': {
'more': 'stuff',
}
}})
self.assertEqual(
jpush.notification(ios=jpush.ios(content_available=True)),
{'ios': { 'content-available': True}})
import unittest
import requests
import sys
sys.path.append('../..')
import jpush as jpush
class TestPush(unittest.TestCase):
def test_full_payload(self):
p = jpush.Push(None)
p.audience = jpush.all_
p.notification = jpush.notification(alert='Hello')
p.options = {}
p.paltform = jpush.all_
p.message = jpush.message("Title", "Body", "text/html", "utf8")
self.assertEqual(p.payload, {
"audience": "all",
"notification": {"alert": "Hello"},
"platform": "all",
"options": {},
"message": {
"msg_content": "Hello message from jpush",
}
})
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