def test_message_received(self): store = {} dispatcher = TestDispatcher() consumer = Consumer(MemoryCache(store), dispatcher, 1) # Don't need to start 5 non-processes... consumer.start() key, value = "mSg", "MsG" #TODO: Our operation is a swapcase : l dispatcher.simulate(TestMessage(key)) self.assertEqual(value, store.get(key))
def start_consumer(cache, dispatcher, config): from workertier.consumer import Consumer consumer = Consumer(cache, dispatcher) consumer.start()
def test_launch(self): n_consumers = 8 dispatcher = TestDispatcher() consumer = Consumer(None, dispatcher, n_consumers) consumer.start() self.assertEqual(n_consumers, dispatcher.started)