def test_get_topic(self): topics = TopicMap(cluster=mock.Mock()) topic = topics.get('topic-1') self.assertIsInstance(topic, Topic) # Retrieving the topic again should return the same object instance. self.assertIs(topic, topics.get('topic-1'))
def test_get_topic(self): topics = TopicMap(cluster=mock.Mock()) with mock.patch('samsa.partitions.DataWatch'): topic = topics.get('topic-1') self.assertIsInstance(topic, Topic) # Retrieving the topic again should return the same object instance. self.assertIs(topic, topics.get('topic-1'))
def __init__(self, zookeeper, handler=None): if not zookeeper.connected: raise Exception("Zookeeper must be connected before use.") self.zookeeper = zookeeper if not handler: handler = ThreadingHandler() self.handler = handler self.brokers = BrokerMap(self) self.topics = TopicMap(self)