def setUp(self): self.application = Application() self.pubsub = ZmqPubSub(self.application) self.pubsub.sub_stream = FakeSocket() self.project_id = 'test' self.namespace = 'test' self.channel = 'test'
def setUp(self): self.application = Application() self.pubsub = ZmqPubSub(self.application) self.pubsub.sub_stream = FakeSocket() self.project_id = 'test' self.namespace = 'test' self.channel = 'test'
class CoreTest(TestCase): def setUp(self): self.application = Application() self.pubsub = ZmqPubSub(self.application) self.pubsub.sub_stream = FakeSocket() self.project_id = 'test' self.namespace = 'test' self.channel = 'test' def test_get_subscription_key(self): subscription_key = self.pubsub.get_subscription_key( self.project_id, self.namespace, self.channel) self.assertTrue(isinstance(subscription_key, str)) def test_add_subscription(self): self.pubsub.add_subscription(self.project_id, self.namespace, self.channel, FakeClient()) self.assertTrue( self.pubsub.get_subscription_key(self.project_id, self.namespace, self.channel) in self.pubsub.subscriptions) def test_remove_subscription(self): self.pubsub.remove_subscription(self.project_id, self.namespace, self.channel, FakeClient()) self.assertTrue( self.pubsub.get_subscription_key(self.project_id, self.namespace, self.channel) not in self.pubsub.subscriptions)
class CoreTest(TestCase): def setUp(self): self.application = Application() self.pubsub = ZmqPubSub(self.application) self.pubsub.sub_stream = FakeSocket() self.project_id = 'test' self.namespace = 'test' self.channel = 'test' def test_get_subscription_key(self): subscription_key = self.pubsub.get_subscription_key( self.project_id, self.namespace, self.channel ) self.assertTrue(isinstance(subscription_key, str)) def test_add_subscription(self): self.pubsub.add_subscription(self.project_id, self.namespace, self.channel, FakeClient()) self.assertTrue( self.pubsub.get_subscription_key( self.project_id, self.namespace, self.channel ) in self.pubsub.subscriptions ) def test_remove_subscription(self): self.pubsub.remove_subscription(self.project_id, self.namespace, self.channel, FakeClient()) self.assertTrue( self.pubsub.get_subscription_key( self.project_id, self.namespace, self.channel ) not in self.pubsub.subscriptions )
def setUp(self): super(ClientTest, self).setUp() self.client = TestClient(FakeSock(), {}) self.client.is_authenticated = True self.client.project_id = "test_project" self.client.uid = "test_uid" self.client.user = "******" self.client.channels = {} self.client.presence_ping = FakePeriodic() self.client.application = Application() self.client.application.pubsub = ZmqPubSub(self.client.application) self.client.application.pubsub.sub_stream = FakeSocket() self.client.application.state = FakeState()