Skip to content

Commit cc97526

Browse files
author
Sebastian Molenda
committed
Remove requirement to pass channels in pubnub.add_channels_to_push
1 parent b227a7f commit cc97526

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

pubnub/pubnub_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def list_push_channels(self, device_id: str = None, push_type: PNPushType = None
629629
"""
630630
return ListPushProvisions(self, device_id=device_id, push_type=push_type, topic=topic, environment=environment)
631631

632-
def add_channels_to_push(self, channels: Union[str, List[str]], device_id: str = None,
632+
def add_channels_to_push(self, channels: Union[str, List[str]] = None, device_id: str = None,
633633
push_type: PNPushType = None, topic: str = None,
634634
environment: PNPushEnvironment = None) -> AddChannelsToPush:
635635
"""Register channels for push notifications.

tests/functional/push/test_add_channels_to_push.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import pubnub.enums
1111

1212
from pubnub.endpoints.push.add_channels_to_push import AddChannelsToPush
13-
from tests.helper import pnconf, sdk_name
13+
from tests.helper import pnconf, pnconf_env_copy, sdk_name
1414
from pubnub.managers import TelemetryManager
15+
from pubnub.enums import PNPushType, PNPushEnvironment
1516

1617

1718
class TestAddChannelsFromPush(unittest.TestCase):
@@ -89,3 +90,15 @@ def test_push_add_single_channel_apns2(self):
8990
})
9091

9192
self.assertEqual(self.add_channels._channels, ['ch'])
93+
94+
def test_add_channels_to_push_builder(self):
95+
config = pnconf_env_copy()
96+
pubnub = PubNub(config)
97+
endpoint = pubnub.add_channels_to_push() \
98+
.channels(['ch1', 'ch2']) \
99+
.device_id("00000000000000000000000000000000") \
100+
.push_type(PNPushType.APNS2) \
101+
.environment(PNPushEnvironment.PRODUCTION) \
102+
.topic("testTopic")
103+
result = endpoint.sync()
104+
self.assertEqual(result.status.error, None)

0 commit comments

Comments
 (0)