Ejemplo n.º 1
0
 def test_get_topics(self):
     connection = ClientConnection(websocket=None)
     connection.add_subscription_channel(12, "whiplash")
     connection.add_publishing_channel(21, "reload")
     topics = connection.get_topics()
     expected_topics = {'reload': 21, 'whiplash': 12}
     self.assertEqual(topics, expected_topics)
Ejemplo n.º 2
0
 def test_get_publisher_topics(self):
     connection = ClientConnection(websocket=None)
     connection.add_subscription_channel(12, "again.do.nothing")
     connection.add_subscription_channel(32, "start.wars")
     expected_topics = ["again.do.nothing", "start.wars"]
     topics = connection.get_subscriber_topics()
     self.assertEqual(sorted(topics), expected_topics)
Ejemplo n.º 3
0
 def test_get_publisher_topics(self):
     connection = ClientConnection(websocket=None)
     connection.add_subscription_channel(12, "again.do.nothing")
     connection.add_subscription_channel(32, "start.wars")
     expected_topics = ["again.do.nothing", "start.wars"]
     topics = connection.get_subscriber_topics()
     self.assertEqual(sorted(topics), expected_topics)
Ejemplo n.º 4
0
 def test_get_topics(self):
     connection = ClientConnection(websocket=None)
     connection.add_subscription_channel(12, "whiplash")
     connection.add_publishing_channel(21, "reload")
     topics = connection.get_topics()
     expected_topics = {'reload': 21, 'whiplash': 12}
     self.assertEqual(topics, expected_topics)
Ejemplo n.º 5
0
 def test_add_subscription_channel(self):
     connection = ClientConnection(websocket=None)
     connection.add_subscription_channel(7, "start.wars")
     expected_topics = {
         "subscriber": {
             "start.wars": 7
         },
         'publisher': {}
     }
     self.assertEqual(connection.topics, expected_topics)
Ejemplo n.º 6
0
 def test_get_subscription_id(self):
     connection = ClientConnection(websocket=None)
     connection.add_subscription_channel(5, "a.new.hope")
     connection.add_subscription_channel(6, "the.empire.strikes.back")
     subscription_id = connection.get_subscription_id("a.new.hope")
     self.assertEqual(subscription_id, 5)
Ejemplo n.º 7
0
 def test_get_subscription_id(self):
     connection = ClientConnection(websocket=None)
     connection.add_subscription_channel(5, "a.new.hope")
     connection.add_subscription_channel(6, "the.empire.strikes.back")
     subscription_id = connection.get_subscription_id("a.new.hope")
     self.assertEqual(subscription_id, 5)
Ejemplo n.º 8
0
 def test_topics_by_subscription_id(self):
     connection = ClientConnection(None)
     connection.add_subscription_channel(10, "weird")
     self.assertEqual(connection.topics_by_subscription_id[10], "weird")