本文整理汇总了Python中pubnub.pubnub_tornado.PubNubTornado.list_channels_in_channel_group方法的典型用法代码示例。如果您正苦于以下问题:Python PubNubTornado.list_channels_in_channel_group方法的具体用法?Python PubNubTornado.list_channels_in_channel_group怎么用?Python PubNubTornado.list_channels_in_channel_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pubnub.pubnub_tornado.PubNubTornado
的用法示例。
在下文中一共展示了PubNubTornado.list_channels_in_channel_group方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestChannelGroups
# 需要导入模块: from pubnub.pubnub_tornado import PubNubTornado [as 别名]
# 或者: from pubnub.pubnub_tornado.PubNubTornado import list_channels_in_channel_group [as 别名]
class TestChannelGroups(AsyncTestCase):
def setUp(self):
super(TestChannelGroups, self).setUp()
self.pubnub = PubNubTornado(pnconf, custom_ioloop=self.io_loop)
@use_cassette_and_stub_time_sleep(
'tests/integrational/fixtures/tornado/groups/add_remove_single_channel.yaml',
filter_query_parameters=['uuid', 'pnsdk'])
@tornado.testing.gen_test
def test_add_remove_single_channel(self):
ch = "channel-groups-tornado-ch"
gr = "channel-groups-tornado-cg"
# add
env = yield self.pubnub.add_channel_to_channel_group() \
.channels(ch).channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsAddChannelResult)
yield gen.sleep(1)
# list
env = yield self.pubnub.list_channels_in_channel_group().channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsListResult)
assert len(env.result.channels) == 1
assert env.result.channels[0] == ch
# remove
env = yield self.pubnub.remove_channel_from_channel_group() \
.channels(ch).channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsRemoveChannelResult)
yield gen.sleep(1)
# list
env = yield self.pubnub.list_channels_in_channel_group().channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsListResult)
assert len(env.result.channels) == 0
self.pubnub.stop()
self.stop()
@use_cassette_and_stub_time_sleep(
'tests/integrational/fixtures/tornado/groups/add_remove_multiple_channel.yaml',
filter_query_parameters=['uuid', 'pnsdk'])
@tornado.testing.gen_test
def test_add_remove_multiple_channels(self):
ch1 = "channel-groups-tornado-ch1"
ch2 = "channel-groups-tornado-ch2"
gr = "channel-groups-tornado-cg"
# add
env = yield self.pubnub.add_channel_to_channel_group() \
.channels([ch1, ch2]).channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsAddChannelResult)
yield gen.sleep(1)
# list
env = yield self.pubnub.list_channels_in_channel_group().channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsListResult)
assert len(env.result.channels) == 2
assert ch1 in env.result.channels
assert ch2 in env.result.channels
# remove
env = yield self.pubnub.remove_channel_from_channel_group() \
.channels([ch1, ch2]).channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsRemoveChannelResult)
yield gen.sleep(1)
# list
env = yield self.pubnub.list_channels_in_channel_group().channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsListResult)
assert len(env.result.channels) == 0
self.pubnub.stop()
self.stop()
@use_cassette_and_stub_time_sleep(
'tests/integrational/fixtures/tornado/groups/add_channel_remove_group.yaml',
filter_query_parameters=['uuid', 'seqn', 'pnsdk'])
@tornado.testing.gen_test
def test_add_channel_remove_group(self):
ch = "channel-groups-tornado-ch"
gr = "channel-groups-tornado-cg"
# add
env = yield self.pubnub.add_channel_to_channel_group() \
.channels(ch).channel_group(gr).future()
assert isinstance(env.result, PNChannelGroupsAddChannelResult)
yield gen.sleep(1)
# list
#.........这里部分代码省略.........