示例#1
0
 def test_channel_receive_none(self):
     """Testing Channel: receive non-existant"""
     channel = Channel()
     channel.subscribe("test")
     channel.publish("bye")
     with self.assertRaises(KeyError):
         [x for x in channel.receive("bye")]
示例#2
0
 def test_channel_receive_none(self):
     """Testing Channel: receive non-existant"""
     channel = Channel()
     channel.subscribe("test")
     channel.publish("bye")
     with self.assertRaises(KeyError):
         [x for x in channel.receive("bye")]
示例#3
0
 def test_channel_publish(self):
     """Testing Channel: publish topic"""
     channel = Channel()
     channel.subscribe("test")
     channel.subscribe("test2")
     channel.publish("hello", topic="test")
     assert [x for x in channel.receive("test")][0] == "hello"
     assert channel.queues["test2"].qsize() == 0
示例#4
0
 def test_channel_publish(self):
     """Testing Channel: publish topic"""
     channel = Channel()
     channel.subscribe("test")
     channel.subscribe("test2")
     channel.publish("hello", topic="test")
     assert [x for x in channel.receive("test")][0] == "hello"
     assert channel.queues["test2"].qsize() == 0
示例#5
0
    def test_log_plugin(self):
        config = Config()
        channel = Channel()
        channel.subscribe("internal.log")
        channel.publish(Value("test", 0))

        kls = log.LogPlugin(config, channel)
        kls.plugin_name = "internal.log"
        kls.write(channel)
示例#6
0
 def test_channel_publish_none(self):
     """Testing Channel: publish non-existant"""
     channel = Channel()
     with self.assertRaises(KeyError):
         channel.publish("bye", topic="fail")
示例#7
0
 def test_channel_broadcast(self):
     """Testing Channel: publish broadcast"""
     channel = Channel()
     channel.subscribe("test")
     channel.publish("hello")
     assert [x for x in channel.receive("test")][0] == "hello"
示例#8
0
 def test_channel_publish_none(self):
     """Testing Channel: publish non-existant"""
     channel = Channel()
     with self.assertRaises(KeyError):
         channel.publish("bye", topic="fail")
示例#9
0
 def test_channel_broadcast(self):
     """Testing Channel: publish broadcast"""
     channel = Channel()
     channel.subscribe("test")
     channel.publish("hello")
     assert [x for x in channel.receive("test")][0] == "hello"