# Path: zaqarclient/tests/queues/base.py
# MY_IP = netutils.get_my_ipv4()
# class QueuesTestBase(base.TestBase):
#     def setUp(self):
# 
# Path: zaqarclient/transport/errors.py
# class TransportError(errors.ZaqarError):
# class ResourceNotFound(TransportError):
# class MalformedRequest(TransportError):
# class UnauthorizedError(TransportError):
# class ForbiddenError(TransportError):
# class InternalServerError(TransportError):
# class ServiceUnavailableError(TransportError):
# class ConflictError(TransportError):
#     def __init__(self, title=None, description=None, text=None):
# 
# 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.tests.queues import base
from zaqarclient.transport import errors
from zaqarclient.transport import response
                               'age': 2309,
                               'confirmed': True,
                               'options': {'oh stop': 'triggering'}}]}

        with mock.patch.object(self.transport, 'send',
                               autospec=True) as send_method:

            list_resp = response.Response(None,
                                          json.dumps(subscription_data))
            send_method.side_effect = iter([list_resp])

            # NOTE(flwang): This will call
            # ensure exists in the client instance
            # since auto_create's default is True
            subscriptions = list(self.client.subscriptions('beijing'))
            self.assertEqual(2, len(subscriptions))

            subscriber_list = [s.subscriber for s in subscriptions]
            self.assertIn('http://trigger.me', subscriber_list)
            self.assertIn('http://trigger.you', subscriber_list)

            # Let's pick one of the subscriptions and check all of its fields
            for sub in subscriptions:
                if sub.subscriber == 'http://trigger.you':
                    self.assertEqual('beijing', sub.queue_name)
                    self.assertEqual('568afabb508f153573f6a56x', sub.id)
                    self.assertEqual(7200, sub.ttl)
                    self.assertEqual({'oh stop': 'triggering'}, sub.options)



# Path: zaqarclient/tests/queues/base.py
# MY_IP = netutils.get_my_ipv4()
# class QueuesTestBase(base.TestBase):
#     def setUp(self):
# 
# Path: zaqarclient/transport/errors.py
# class TransportError(errors.ZaqarError):
# class ResourceNotFound(TransportError):
# class MalformedRequest(TransportError):
# class UnauthorizedError(TransportError):
# class ForbiddenError(TransportError):
# class InternalServerError(TransportError):
# class ServiceUnavailableError(TransportError):
# class ConflictError(TransportError):
#     def __init__(self, title=None, description=None, text=None):
# 
# 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/subscriptions.py
import json
import mock
from zaqarclient.tests.queues import base
from zaqarclient.transport import errors
from zaqarclient.transport import response

                               'age': 2309,
                               'confirmed': True,
                               'options': {'oh stop': 'triggering'}}]}

        with mock.patch.object(self.transport, 'send',
                               autospec=True) as send_method:

            list_resp = response.Response(None,
                                          json.dumps(subscription_data))
            send_method.side_effect = iter([list_resp])

            # NOTE(flwang): This will call
            # ensure exists in the client instance
            # since auto_create's default is True
            subscriptions = list(self.client.subscriptions('beijing'))
            self.assertEqual(2, len(subscriptions))

            subscriber_list = [s.subscriber for s in subscriptions]
            self.assertIn('http://trigger.me', subscriber_list)
            self.assertIn('http://trigger.you', subscriber_list)

            # Let's pick one of the subscriptions and check all of its fields
            for sub in subscriptions:
                if sub.subscriber == 'http://trigger.you':
                    self.assertEqual('beijing', sub.queue_name)
                    self.assertEqual('568afabb508f153573f6a56x', sub.id)
                    self.assertEqual(7200, sub.ttl)
                    self.assertEqual({'oh stop': 'triggering'}, sub.options)



class QueuesV2SubscriptionFunctionalTest(base.QueuesTestBase):