Exemple #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']
                                   }
                               })
    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_update_tagusers(self):
     tag = "ddd"
     entity = jpush.device_regid(jpush.add("090c1f59f89"))
     result = device.update_tagusers(tag, entity)
     self.assertEqual(result.status_code, 200)
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()
tag = "ddd"
entity = jpush.device_regid(jpush.add("090c1f59f89"))
device.update_tagusers(tag, entity)
Exemple #5
0
 def test_update_tagusers(self):
     tag = "ddd"
     entity = jpush.device_regid(jpush.add("090c1f59f89"))
     result = device.update_tagusers(tag, entity)
     self.assertEqual(result.status_code, 200)
 def test_update_tagusers(self):
     tag = "ddd"
     entity = jpush.device_regid(jpush.add("160a3797c80d93ce897"))
     result = device.update_tagusers(tag, entity)
     self.assertEqual(result.status_code, 200)
Exemple #7
0
 def post(self, request):
     tag = self.request.data.get('tag')
     reg_id = self.request.data.get('reg_id')
     entity = jpush.device_regid(jpush.add(reg_id))
     res = self.my_device.update_tagusers(tag=tag, entity=entity)
     return Response(res.payload)