# Path: zaqarclient/queues/v1/api.py
# class V1(api.Api):
# class V1_1(V1):
# 
# Path: zaqarclient/queues/v2/api.py
# class V2(api.V1_1):
# 
# Path: zaqarclient/tests/base.py
# _USE_AUTHENTICATION = os.environ.get('ZAQARCLIENT_AUTH_FUNCTIONAL', False)
# _RUN_FUNCTIONAL = os.environ.get('ZAQARCLIENT_TEST_FUNCTIONAL',
#                                  _USE_AUTHENTICATION)
# class TestBase(testtools.TestCase):
#     def setUp(self):
#     def _credentials(self, cloud='devstack-admin'):
#     def _setup_auth_params(self):
#     def config(self, group=None, **kw):
# 
# Path: zaqarclient/transport/request.py
# def prepare_request(auth_opts=None, data=None, **kwargs):
#     def __init__(self, endpoint='', operation='',
#                  ref='', content=None, params=None,
#                  headers=None, api=None, verify=True, cert=None, session=None):
#     def api(self):
#     def validate(self):
# class Request(object):


import json
from zaqarclient.queues.v1 import api as api_v1
from zaqarclient.queues.v2 import api as api_v2
from zaqarclient.tests import base
from zaqarclient.transport import request
        self.assertIsInstance(req, request.Request)
        self.assertIsNone(req.content)

    def test_prepare_request_with_data(self):
        auth_opts = self.conf.get('auth_opts', {})
        data = {"data": "tons of GBs"}
        req = request.prepare_request(auth_opts, data=data)
        self.assertIsInstance(req, request.Request)
        self.assertEqual(json.dumps(data), req.content)

    def test_request_with_right_version(self):
        auth_opts = self.conf.get('auth_opts', {})
        api_version = 1
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v1.V1)

        api_version = 1.0
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v1.V1)

        api_version = 1.1
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v1.V1_1)

        api_version = 2
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v2.V2)

        api_version = 2.0
        req = request.prepare_request(auth_opts, api=api_version)

# Path: zaqarclient/queues/v1/api.py
# class V1(api.Api):
# class V1_1(V1):
# 
# Path: zaqarclient/queues/v2/api.py
# class V2(api.V1_1):
# 
# Path: zaqarclient/tests/base.py
# _USE_AUTHENTICATION = os.environ.get('ZAQARCLIENT_AUTH_FUNCTIONAL', False)
# _RUN_FUNCTIONAL = os.environ.get('ZAQARCLIENT_TEST_FUNCTIONAL',
#                                  _USE_AUTHENTICATION)
# class TestBase(testtools.TestCase):
#     def setUp(self):
#     def _credentials(self, cloud='devstack-admin'):
#     def _setup_auth_params(self):
#     def config(self, group=None, **kw):
# 
# Path: zaqarclient/transport/request.py
# def prepare_request(auth_opts=None, data=None, **kwargs):
#     def __init__(self, endpoint='', operation='',
#                  ref='', content=None, params=None,
#                  headers=None, api=None, verify=True, cert=None, session=None):
#     def api(self):
#     def validate(self):
# class Request(object):


# Path: tests/unit/transport/test_request.py
import json
from zaqarclient.queues.v1 import api as api_v1
from zaqarclient.queues.v2 import api as api_v2
from zaqarclient.tests import base
from zaqarclient.transport import request

        self.assertIsInstance(req, request.Request)
        self.assertIsNone(req.content)

    def test_prepare_request_with_data(self):
        auth_opts = self.conf.get('auth_opts', {})
        data = {"data": "tons of GBs"}
        req = request.prepare_request(auth_opts, data=data)
        self.assertIsInstance(req, request.Request)
        self.assertEqual(json.dumps(data), req.content)

    def test_request_with_right_version(self):
        auth_opts = self.conf.get('auth_opts', {})
        api_version = 1
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v1.V1)

        api_version = 1.0
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v1.V1)

        api_version = 1.1
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v1.V1_1)

        api_version = 2
        req = request.prepare_request(auth_opts, api=api_version)
        self.assertIsInstance(req.api, api_v2.V2)

        api_version = 2.0
        req = request.prepare_request(auth_opts, api=api_version)

        self.assertIsInstance(req.api, api_v2.V2)