Example #1
0
    def test_subscribe_new(self):
        p = PubSubManager()
        p.subscribe("client", "topic")

        # check that the topic was created
        self.assertEqual(len(p.subscriptions.keys()), 1)

        # check that we are subbed
        self.assertTrue("client" in p.subscriptions["topic"])
        self.assertTrue(len(p.subscriptions["topic"]), 1)
  def test_subscribe_new(self):
    p = PubSubManager()
    p.subscribe("client", "topic")

    # check that the topic was created
    self.assertEqual(len(p.subscriptions.keys()), 1)

    # check that we are subbed
    self.assertTrue("client" in p.subscriptions["topic"])
    self.assertTrue(len(p.subscriptions["topic"]), 1)
Example #3
0
    def test_subscribe_existing(self):
        p = PubSubManager()
        p.subscriptions["topic"] = {"other client"}

        p.subscribe("client", "topic")

        # check that the topic was reused
        self.assertEqual(len(p.subscriptions.keys()), 1)

        # check that we are subbed
        self.assertTrue("client" in p.subscriptions["topic"])
        self.assertTrue(len(p.subscriptions["topic"]), 2)
  def test_subscribe_existing(self):
    p = PubSubManager()
    p.subscriptions["topic"] = set(["other client"])

    p.subscribe("client", "topic")

    # check that the topic was reused
    self.assertEqual(len(p.subscriptions.keys()), 1)

    # check that we are subbed
    self.assertTrue("client" in p.subscriptions["topic"])
    self.assertTrue(len(p.subscriptions["topic"]), 2)