예제 #1
0
    def test_delete(self, channel):
        url = 'test-url'

        # test
        queue = Queue('test')
        queue.delete(url)

        # validation
        channel.return_value.queue_delete.assert_called_once_with(queue.name, nowait=True)
예제 #2
0
    def test_declare(self, channel):
        url = 'test-url'

        # test
        queue = Queue('test')
        queue.declare(url)

        # validation
        channel.return_value.queue_declare.assert_called_once_with(
            queue.name,
            durable=queue.durable,
            exclusive=queue.exclusive,
            auto_delete=queue.auto_delete,
            arguments=None)
예제 #3
0
 def test_init(self):
     name = 'test-queue'
     queue = Queue(name)
     self.assertEqual(queue.name, name)
     self.assertTrue(isinstance(queue, BaseQueue))
     self.assertEqual(queue.exclusive, False)
     self.assertEqual(queue.auto_delete, False)
     self.assertEqual(queue.expiration, 0)
예제 #4
0
    def test_declare_auto_delete(self, channel):
        url = 'test-url'

        # test
        queue = Queue('test')
        queue.auto_delete = True
        queue.expiration = 10
        queue.declare(url)

        # validation
        channel.return_value.queue_declare.assert_called_once_with(
            queue.name,
            durable=queue.durable,
            exclusive=queue.exclusive,
            auto_delete=queue.auto_delete,
            arguments={'x-expires': queue.expiration * 1000})