本文整理汇总了Python中pypeman.channels.BaseChannel.replay方法的典型用法代码示例。如果您正苦于以下问题:Python BaseChannel.replay方法的具体用法?Python BaseChannel.replay怎么用?Python BaseChannel.replay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypeman.channels.BaseChannel
的用法示例。
在下文中一共展示了BaseChannel.replay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_replay_from_memory_message_store
# 需要导入模块: from pypeman.channels import BaseChannel [as 别名]
# 或者: from pypeman.channels.BaseChannel import replay [as 别名]
def test_replay_from_memory_message_store(self):
""" We can store a message in FileMessageStore """
store_factory = msgstore.MemoryMessageStoreFactory()
chan = BaseChannel(name="test_channel10.5", loop=self.loop, message_store_factory=store_factory)
n = TestNode()
msg = generate_msg(with_context=True)
msg2 = generate_msg(timestamp=(1982, 11, 27, 12, 35))
chan.add(n)
# Launch channel processing
self.start_channels()
self.loop.run_until_complete(chan.handle(msg))
self.loop.run_until_complete(chan.handle(msg2))
msg_stored = list(self.loop.run_until_complete(chan.message_store.search()))
for msg in msg_stored:
print(msg)
self.assertEqual(len(msg_stored), 2, "Should be 2 messages in store!")
self.loop.run_until_complete(chan.replay(msg_stored[0]['id']))
msg_stored = list(self.loop.run_until_complete(chan.message_store.search()))
self.assertEqual(len(msg_stored), 3, "Should be 3 messages in store!")