Exemplo n.º 1
0
class DescribeEnsureConsumingNotAlreadyConsuming(_BaseTestCase):
    def configure(self):
        self.agent = ConsumerAgent(sentinel.consumer, sentinel.broker,
                                   sentinel.bindings)
        self.agent.is_consuming_from = MagicMock(return_value=False)
        self.agent.start_consuming = MagicMock()

    def execute(self):
        self.agent.ensure_consuming(sentinel.queue, sentinel.method_frame)

    def should_check_current_status(self):
        self.agent.is_consuming_from.assert_called_once_with(sentinel.queue)

    def should_start_consuming(self):
        self.agent.start_consuming.assert_called_once_with(sentinel.queue)
Exemplo n.º 2
0
class DescribeEnsureConsumingNotAlreadyConsuming(_BaseTestCase):

    def configure(self):
        self.agent = ConsumerAgent(sentinel.consumer, sentinel.broker,
                                   sentinel.bindings)
        self.agent.is_consuming_from = MagicMock(return_value=False)
        self.agent.start_consuming = MagicMock()

    def execute(self):
        self.agent.ensure_consuming(sentinel.queue, sentinel.method_frame)

    def should_check_current_status(self):
        self.agent.is_consuming_from.assert_called_once_with(sentinel.queue)

    def should_start_consuming(self):
        self.agent.start_consuming.assert_called_once_with(sentinel.queue)