示例#1
0
    def test_claim_create(self):
        zc = zaqar_v2.ZaqarClient(self.conn_params)
        attrs = {'k1': 'v1'}

        zc.claim_create('foo', **attrs)

        self.message.create_claim.assert_called_once_with('foo', k1='v1')
示例#2
0
    def test_queue_delete(self):
        zc = zaqar_v2.ZaqarClient(self.conn_params)
        zc.queue_delete('foo', True)
        self.message.delete_queue.assert_called_once_with('foo', True)
        self.message.delete_queue.reset_mock()

        zc.queue_delete('foo', False)
        self.message.delete_queue.assert_called_once_with('foo', False)
        self.message.delete_queue.reset_mock()

        zc.queue_delete('foo')
        self.message.delete_queue.assert_called_once_with('foo', True)
示例#3
0
    def test_claim_delete(self):
        zc = zaqar_v2.ZaqarClient(self.conn_params)
        zc.claim_delete('foo', 'CLAIM_ID', True)
        self.message.delete_claim.assert_called_once_with(
            'foo', 'CLAIM_ID', True)
        self.message.delete_claim.reset_mock()

        zc.claim_delete('foo', 'CLAIM_ID', False)
        self.message.delete_claim.assert_called_once_with(
            'foo', 'CLAIM_ID', False)
        self.message.delete_claim.reset_mock()

        zc.claim_delete('foo', 'CLAIM_ID')
        self.message.delete_claim.assert_called_once_with(
            'foo', 'CLAIM_ID', True)
示例#4
0
    def test_subscription_delete(self):
        zc = zaqar_v2.ZaqarClient(self.conn_params)
        zc.subscription_delete('foo', 'SUBSCRIPTION_ID', True)
        self.message.delete_subscription.assert_called_once_with(
            'foo', 'SUBSCRIPTION_ID', True)
        self.message.delete_subscription.reset_mock()

        zc.subscription_delete('foo', 'SUBSCRIPTION_ID', False)
        self.message.delete_subscription.assert_called_once_with(
            'foo', 'SUBSCRIPTION_ID', False)
        self.message.delete_subscription.reset_mock()

        zc.subscription_delete('foo', 'SUBSCRIPTION_ID')
        self.message.delete_subscription.assert_called_once_with(
            'foo', 'SUBSCRIPTION_ID', True)
示例#5
0
    def test_message_delete(self):
        zc = zaqar_v2.ZaqarClient(self.conn_params)
        zc.message_delete('foo', 'MESSAGE_ID', None, True)
        self.message.delete_message.assert_called_once_with(
            'foo', 'MESSAGE_ID', None, True)
        self.message.delete_message.reset_mock()

        zc.message_delete('foo', 'MESSAGE_ID', None, False)
        self.message.delete_message.assert_called_once_with(
            'foo', 'MESSAGE_ID', None, False)
        self.message.delete_message.reset_mock()

        zc.message_delete('foo', 'MESSAGE_ID')
        self.message.delete_message.assert_called_once_with(
            'foo', 'MESSAGE_ID', None, True)
        self.message.delete_message.reset_mock()

        zc.message_delete('foo', 'MESSAGE_ID', 'CLAIM_ID')
        self.message.delete_message.assert_called_once_with(
            'foo', 'MESSAGE_ID', 'CLAIM_ID', True)
示例#6
0
 def test_queue_create(self):
     zc = zaqar_v2.ZaqarClient(self.conn_params)
     zc.queue_create(name='foo')
     self.message.create_queue.assert_called_once_with(name='foo')
示例#7
0
 def test_init(self):
     zc = zaqar_v2.ZaqarClient(self.conn_params)
     self.mock_create.assert_called_once_with(self.conn_params)
     self.assertEqual(self.mock_conn, zc.conn)