Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_set_device_mobile(self):
reg_id = '1507bfd3f7c466c355c'
entity = jpush.device_tag(jpush.add("ddd", "tageee"))
result = device.set_devicemobile(reg_id, entity)
self.assertEqual(result.status_code, 200)
def test_compound_entity(self):
self.assertEqual(
jpush.device_tag(jpush.add("tag1", "tag2")),
{'tags':{'add':['tag1', 'tag2']}})
self.assertEqual(
jpush.device_tag(jpush.remove("tag1", "tag2")),
{'tags':{'remove':['tag1', 'tag2']}})
self.assertEqual(
jpush.device_alias(jpush.add("alias1", "alias2"), jpush.remove("alias3", "alias4")),
{'alias':{'add':['alias1', 'alias2'], 'remove':['alias3', 'alias4']}})
self.assertEqual(
jpush.device_regid(jpush.add("regid1", "regid2"), jpush.remove("regid3", "regid4")),
{'registration_ids':{'add':['regid1', 'regid2'], 'remove':['regid3', 'regid4']}})
def test_create_device(self):
reg_id = '1507bfd3f7c466c355c'
entity = jpush.device_tag(jpush.add("ddd", "tageee"))
result = device.set_devicemobile(reg_id, entity)
self.assertEqual(result.status_code, 200)
def test_clear_tag(self):
reg_id = '090c1f59f89'
entity = jpush.device_tag("")
try:
device.set_deviceinfo(reg_id, entity)
except common.JPushFailure:
self.assertEqual(1, 1)
except:
self.assertEqual(1, 0)
def test_compound_entity(self):
self.assertEqual(
jpush.device_tag(jpush.add("tag1", "tag2")),
{'tags':{'add':['tag1', 'tag2']}})
self.assertEqual(
jpush.device_tag(jpush.remove("tag1", "tag2")),
{'tags':{'remove':['tag1', 'tag2']}})
self.assertEqual(
jpush.device_alias(jpush.add("alias1", "alias2"), jpush.remove("alias3", "alias4")),
{'alias':{'add':['alias1', 'alias2'], 'remove':['alias3', 'alias4']}})
self.assertEqual(
jpush.device_regid(jpush.add("regid1", "regid2"), jpush.remove("regid3", "regid4")),
{'registration_ids':{'add':['regid1', 'regid2'], 'remove':['regid3', 'regid4']}})
import jpush as jpush
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
reg_id = '1507bfd3f7c466c355c'
entity = jpush.device_tag(jpush.add("ddd", "tageee"))
result=device.set_devicemobile(reg_id, entity)
print (result.status_code)
print (result.payload)
import jpush as jpush
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
reg_id = '090c1f59f89'
entity = jpush.device_tag("")
device.set_deviceinfo(reg_id, entity)
import jpush as jpush
from examples.conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
reg_id = '090c1f59f89'
entity = jpush.device_tag("")
device.set_deviceinfo(reg_id, entity)