# Path: zaqarclient/errors.py
# class ZaqarError(Exception):
# class DriverLoadFailure(ZaqarError):
# class InvalidOperation(ZaqarError):
# class UnsupportedVersion(ZaqarError):
#     def __init__(self, driver, ex):
# 
# Path: zaqarclient/queues/client.py
# _CLIENTS = {1: cv1.Client,
#             1.1: cv1.Client,
#             2: cv2.Client}
# def Client(url=None, version=None, conf=None, session=None):
# 
# Path: zaqarclient/queues/v1/iterator.py
# class _Iterator(object):
#     def __init__(self, client, listing_response, iter_key, create_function):
#     def __iter__(self):
#     def get_iterables(self, iterables):
#     def stream(self, enabled=True):
#     def _next_page(self):
#     def __next__(self):
# 
# Path: zaqarclient/queues/v1/message.py
# class Message(object):
#     def __init__(self, queue, ttl, age, body, href=None, id=None,
#                  claim_id=None, claim_count=0, checksum=None):
#     def __repr__(self):
#     def claim_id(self):
#     def delete(self):
# def create_object(parent):
# 
# Path: zaqarclient/queues/v2/subscription.py
# class Subscription(object):
#     def __init__(self, client, queue_name, subscriber=None, ttl=60, id=None,
#                  auto_create=True, **kwargs):
#     def ensure_exists(self):
#     def update(self, subscription_data):
#     def delete(self):
# def create_object(parent):
# 
# Path: zaqarclient/tests/queues/base.py
# MY_IP = netutils.get_my_ipv4()
# class QueuesTestBase(base.TestBase):
#     def setUp(self):
# 
# Path: zaqarclient/transport/response.py
# class Response(object):
#     def __init__(self, request, content, headers=None, status_code=None):
#     def deserialized_content(self):


import json
import mock
from zaqarclient import errors
from zaqarclient.queues import client
from zaqarclient.queues.v1 import iterator
from zaqarclient.queues.v1 import message
from zaqarclient.queues.v2 import subscription
from zaqarclient.tests.queues import base
from zaqarclient.transport import response
            'expires': signature['expires'],
            'methods': signature['methods'],
            'signature': signature['signature'],
            'os_project_id': signature['project'],
        }
        auth_opts = {'backend': 'signed-url',
                     'options': opts}
        conf = {'auth_opts': auth_opts}
        signed_client = client.Client(self.url, self.version, conf)
        queue = signed_client.queue('test_queue')
        [message] = list(queue.messages())
        self.assertEqual('Post It!', message.body)

    def test_queue_subscriptions(self):
        queue_name = 'test_queue'
        queue = self.client.queue(queue_name, force_create=True)
        self.addCleanup(queue.delete)
        queue._get_transport = mock.Mock(return_value=self.transport)

        subscription.Subscription(self.client, queue_name,
                                  subscriber='http://trigger.me')
        subscription.Subscription(self.client, queue_name,
                                  subscriber='http://trigger.you')

        get_subscriptions = queue.subscriptions()
        self.assertIsInstance(get_subscriptions, iterator._Iterator)
        self.assertEqual(2, len(list(get_subscriptions)))

    def test_queue_metadata_reload_functional(self):
        test_metadata = {'type': 'Bank Accounts', 'name': 'test1'}

# Path: zaqarclient/errors.py
# class ZaqarError(Exception):
# class DriverLoadFailure(ZaqarError):
# class InvalidOperation(ZaqarError):
# class UnsupportedVersion(ZaqarError):
#     def __init__(self, driver, ex):
# 
# Path: zaqarclient/queues/client.py
# _CLIENTS = {1: cv1.Client,
#             1.1: cv1.Client,
#             2: cv2.Client}
# def Client(url=None, version=None, conf=None, session=None):
# 
# Path: zaqarclient/queues/v1/iterator.py
# class _Iterator(object):
#     def __init__(self, client, listing_response, iter_key, create_function):
#     def __iter__(self):
#     def get_iterables(self, iterables):
#     def stream(self, enabled=True):
#     def _next_page(self):
#     def __next__(self):
# 
# Path: zaqarclient/queues/v1/message.py
# class Message(object):
#     def __init__(self, queue, ttl, age, body, href=None, id=None,
#                  claim_id=None, claim_count=0, checksum=None):
#     def __repr__(self):
#     def claim_id(self):
#     def delete(self):
# def create_object(parent):
# 
# Path: zaqarclient/queues/v2/subscription.py
# class Subscription(object):
#     def __init__(self, client, queue_name, subscriber=None, ttl=60, id=None,
#                  auto_create=True, **kwargs):
#     def ensure_exists(self):
#     def update(self, subscription_data):
#     def delete(self):
# def create_object(parent):
# 
# Path: zaqarclient/tests/queues/base.py
# MY_IP = netutils.get_my_ipv4()
# class QueuesTestBase(base.TestBase):
#     def setUp(self):
# 
# Path: zaqarclient/transport/response.py
# class Response(object):
#     def __init__(self, request, content, headers=None, status_code=None):
#     def deserialized_content(self):


# Path: zaqarclient/tests/queues/queues.py
import json
import mock
from zaqarclient import errors
from zaqarclient.queues import client
from zaqarclient.queues.v1 import iterator
from zaqarclient.queues.v1 import message
from zaqarclient.queues.v2 import subscription
from zaqarclient.tests.queues import base
from zaqarclient.transport import response

            'expires': signature['expires'],
            'methods': signature['methods'],
            'signature': signature['signature'],
            'os_project_id': signature['project'],
        }
        auth_opts = {'backend': 'signed-url',
                     'options': opts}
        conf = {'auth_opts': auth_opts}
        signed_client = client.Client(self.url, self.version, conf)
        queue = signed_client.queue('test_queue')
        [message] = list(queue.messages())
        self.assertEqual('Post It!', message.body)

    def test_queue_subscriptions(self):
        queue_name = 'test_queue'
        queue = self.client.queue(queue_name, force_create=True)
        self.addCleanup(queue.delete)
        queue._get_transport = mock.Mock(return_value=self.transport)

        subscription.Subscription(self.client, queue_name,
                                  subscriber='http://trigger.me')
        subscription.Subscription(self.client, queue_name,
                                  subscriber='http://trigger.you')

        get_subscriptions = queue.subscriptions()
        self.assertIsInstance(get_subscriptions, iterator._Iterator)
        self.assertEqual(2, len(list(get_subscriptions)))

    def test_queue_metadata_reload_functional(self):
        test_metadata = {'type': 'Bank Accounts', 'name': 'test1'}

        queue = self.client.queue("meta-test", force_create=True)