예제 #1
0
class DescribeBindQueue(_BaseTestCase):
    __contexts__ = (('partial',
                     patch(mod + '.partial',
                           return_value=sentinel.callback)), )

    def configure(self):
        self.kwargs = {
            'queue': sentinel.queue,
            'exchange': sentinel.exchange,
            'routing_key': sentinel.routing_key,
            'method_frame': sentinel.method_frame
        }
        self.agent = ConsumerAgent(sentinel.consumer, sentinel.broker,
                                   sentinel.bindings)
        self.agent.channel = MagicMock()

    def execute(self):
        self.agent.bind_queue(**self.kwargs)

    def should_create_on_queue_bind_ok_callback(self):
        self.ctx.partial.assert_called_once_with(self.agent.ensure_consuming,
                                                 sentinel.queue)

    def should_bind_queue(self):
        self.agent.channel.queue_bind.assert_called_once_with(
            sentinel.callback, sentinel.queue, sentinel.exchange,
            sentinel.routing_key)
예제 #2
0
class DescribeBindQueue(_BaseTestCase):
    __contexts__ = (
        ('partial', patch(mod + '.partial', return_value=sentinel.callback)),
    )

    def configure(self):
        self.kwargs = {
            'queue': sentinel.queue,
            'exchange': sentinel.exchange,
            'routing_key': sentinel.routing_key,
            'method_frame': sentinel.method_frame
        }
        self.agent = ConsumerAgent(sentinel.consumer, sentinel.broker,
                                   sentinel.bindings)
        self.agent.channel = MagicMock()

    def execute(self):
        self.agent.bind_queue(**self.kwargs)

    def should_create_on_queue_bind_ok_callback(self):
        self.ctx.partial.assert_called_once_with(self.agent.ensure_consuming,
                                                 sentinel.queue)

    def should_bind_queue(self):
        self.agent.channel.queue_bind.assert_called_once_with(
            sentinel.callback, sentinel.queue, sentinel.exchange,
            sentinel.routing_key)