# 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/tests/transport/api.py
# class FakeApi(api.Api):
# 
# Path: zaqarclient/transport/http.py
# class HttpTransport(base.Transport):
#     def __init__(self, options):
#     def _prepare(self, request):
#     def send(self, request):
# 
# 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 mock
import requests as prequest
from requests.packages.urllib3 import response
from zaqarclient.tests import base
from zaqarclient.tests.transport import api
from zaqarclient.transport import http
from zaqarclient.transport import request
    def test_send_without_api(self, mock_stream):
        params = {'name': 'Test',
                  'address': 'Outer space'}
        req = request.Request('http://example.org/',
                              operation='test_operation',
                              params=params)

        with mock.patch.object(self.transport.client, 'request',
                               autospec=True) as request_method:

            resp = prequest.Response()
            raw = response.HTTPResponse()
            resp.raw = raw
            request_method.return_value = resp
            self.transport.send(req)

            final_url = 'http://example.org/'
            final_headers = {'content-type': 'application/json'}

            request_method.assert_called_with('GET', url=final_url,
                                              params=params,
                                              headers=final_headers,
                                              data=None,
                                              verify=True)

    @mock.patch.object(prequest.packages.urllib3.response.HTTPResponse,
                       'stream')
    def test_error_handling(self, mock_stream):
        params = {'name': 'Opportunity',
                  'address': 'NASA'}

# 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/tests/transport/api.py
# class FakeApi(api.Api):
# 
# Path: zaqarclient/transport/http.py
# class HttpTransport(base.Transport):
#     def __init__(self, options):
#     def _prepare(self, request):
#     def send(self, request):
# 
# 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_http.py
import mock
import requests as prequest
from requests.packages.urllib3 import response
from zaqarclient.tests import base
from zaqarclient.tests.transport import api
from zaqarclient.transport import http
from zaqarclient.transport import request

    def test_send_without_api(self, mock_stream):
        params = {'name': 'Test',
                  'address': 'Outer space'}
        req = request.Request('http://example.org/',
                              operation='test_operation',
                              params=params)

        with mock.patch.object(self.transport.client, 'request',
                               autospec=True) as request_method:

            resp = prequest.Response()
            raw = response.HTTPResponse()
            resp.raw = raw
            request_method.return_value = resp
            self.transport.send(req)

            final_url = 'http://example.org/'
            final_headers = {'content-type': 'application/json'}

            request_method.assert_called_with('GET', url=final_url,
                                              params=params,
                                              headers=final_headers,
                                              data=None,
                                              verify=True)

    @mock.patch.object(prequest.packages.urllib3.response.HTTPResponse,
                       'stream')
    def test_error_handling(self, mock_stream):
        params = {'name': 'Opportunity',
                  'address': 'NASA'}

        req = request.Request('http://example.org/',