def test_platform_payload_dict(self): payload = PlatformPayload(platform_type=PlatformPayloadType.ANDROID, priority=PlatformPayloadPriority.NORMAL, collapse_key='android_collapse_key') self.assertNotEqual( payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.APNS))
def test_platform_payload_webpush(self): payload = PlatformPayload(platform_type=PlatformPayloadType.WEBPUSH, priority=PlatformPayloadPriority.NORMAL, collapse_key='web_collapse_key') self.assertEqual(payload.payload_dict, { 'Urgency': 'normal', 'Topic': 'web_collapse_key' }) self.assertEqual( payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.WEBPUSH))
def test_platform_payload_apns(self): payload = PlatformPayload(platform_type=PlatformPayloadType.APNS, priority=PlatformPayloadPriority.NORMAL, collapse_key='ios_collapse_key') self.assertEqual(payload.payload_dict, { 'apns-priority': '5', 'apns-collapse-id': 'ios_collapse_key' }) self.assertEqual( payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.APNS))
def test_platform_payload_android(self): payload = PlatformPayload(platform_type=PlatformPayloadType.ANDROID, priority=PlatformPayloadPriority.NORMAL, collapse_key='android_collapse_key') self.assertEqual(payload.payload_dict, { 'priority': 'NORMAL', 'collapse_key': 'android_collapse_key' }) self.assertEqual( payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.ANDROID))
def test_platform_payload_webpush(self): payload = PlatformPayload(platform_type=PlatformPayloadType.WEBPUSH, priority=PlatformPayloadPriority.NORMAL, collapse_key='web_collapse_key') self.assertEqual(payload.payload_dict, {'Urgency': 'normal', 'Topic': 'web_collapse_key'}) self.assertEqual(payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.WEBPUSH))
def test_platform_payload_apns(self): payload = PlatformPayload(platform_type=PlatformPayloadType.APNS, priority=PlatformPayloadPriority.NORMAL, collapse_key='ios_collapse_key') self.assertEqual(payload.payload_dict, {'apns-priority': '5', 'apns-collapse-id': 'ios_collapse_key'}) self.assertEqual(payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.APNS))
def test_platform_payload_android(self): payload = PlatformPayload(platform_type=PlatformPayloadType.ANDROID, priority=PlatformPayloadPriority.NORMAL, collapse_key='android_collapse_key') self.assertEqual(payload.payload_dict, {'priority': 'NORMAL', 'collapse_key': 'android_collapse_key'}) self.assertEqual(payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.ANDROID))
def test_platform_payload_dict(self): payload = PlatformPayload(platform_type=PlatformPayloadType.ANDROID, priority=PlatformPayloadPriority.NORMAL, collapse_key='android_collapse_key') self.assertNotEqual(payload.payload_dict, payload.platform_payload_dict(PlatformPayloadType.APNS))
def test_platform_payload_dict_unsupported(self): payload = PlatformPayload() with self.assertRaises(TypeError): payload.platform_payload_dict(200)
def test_platform_payload_dict_unsupported(self): payload = PlatformPayload() with self.assertRaises(TypeError): payload.platform_payload_dict(200)