class DescribeProcess(_BaseTestCase): __contexts__ = (('Message', patch(mod + '.Message')), ) def configure(self): self.consumer = MagicMock() self.ctx.Message.return_value = self.message = NonCallableMagicMock() self.agent = ConsumerAgent(self.consumer, sentinel.broker, sentinel.bindings) self.agent.acknowledge = MagicMock() self.agent._process = MagicMock() def execute(self): self.agent.process(sentinel.channel, sentinel.method, sentinel.header, sentinel.body) def should_instantiate_message(self): self.ctx.Message.assert_called_once_with(sentinel.channel, sentinel.method, sentinel.header, sentinel.body) def should_call__process(self): self.agent._process.assert_called_once_with(self.message) def should_acknowledge_message(self): self.agent.acknowledge.assert_called_once_with(self.message)
class DescribeProcess(_BaseTestCase): __contexts__ = ( ('Message', patch(mod + '.Message')), ) def configure(self): self.consumer = MagicMock() self.ctx.Message.return_value = self.message = NonCallableMagicMock() self.agent = ConsumerAgent(self.consumer, sentinel.broker, sentinel.bindings) self.agent.acknowledge = MagicMock() self.agent._process = MagicMock() def execute(self): self.agent.process(sentinel.channel, sentinel.method, sentinel.header, sentinel.body) def should_instantiate_message(self): self.ctx.Message.assert_called_once_with( sentinel.channel, sentinel.method, sentinel.header, sentinel.body) def should_call__process(self): self.agent._process.assert_called_once_with(self.message) def should_acknowledge_message(self): self.agent.acknowledge.assert_called_once_with(self.message)