Merge "Remove unused json_request()"
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 7860556..800e977 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -24,12 +24,10 @@
 
 import OpenSSL
 from oslo_log import log as logging
-from oslo_serialization import jsonutils as json
 import six
 from six import moves
 from six.moves import http_client as httplib
 from six.moves.urllib import parse as urlparse
-from tempest_lib import exceptions as lib_exc
 
 from tempest import exceptions as exc
 
@@ -160,30 +158,6 @@
                 self.LOG.debug("Large body (%d) md5 summary: %s", length,
                                hashlib.md5(str_body).hexdigest())
 
-    def json_request(self, method, url, **kwargs):
-        kwargs.setdefault('headers', {})
-        kwargs['headers'].setdefault('Content-Type', 'application/json')
-        if kwargs['headers']['Content-Type'] != 'application/json':
-            msg = "Only application/json content-type is supported."
-            raise lib_exc.InvalidContentType(msg)
-
-        if 'body' in kwargs:
-            kwargs['body'] = json.dumps(kwargs['body'])
-
-        resp, body_iter = self._http_request(url, method, **kwargs)
-
-        if 'application/json' in resp.getheader('content-type', ''):
-            body = ''.join([chunk for chunk in body_iter])
-            try:
-                body = json.loads(body)
-            except ValueError:
-                LOG.error('Could not decode response body as JSON')
-        else:
-            msg = "Only json/application content-type is supported."
-            raise lib_exc.InvalidContentType(msg)
-
-        return resp, body
-
     def raw_request(self, method, url, **kwargs):
         kwargs.setdefault('headers', {})
         kwargs['headers'].setdefault('Content-Type',
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index a446be6..ed886da 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -13,14 +13,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import socket
-
 import mock
-from oslo_serialization import jsonutils as json
 from oslotest import mockpatch
 import six
 from six.moves import http_client as httplib
-from tempest_lib import exceptions as lib_exc
 
 from tempest.common import glance_http
 from tempest import exceptions
@@ -56,60 +52,6 @@
                         'getresponse', return_value=resp))
         return resp
 
-    def test_json_request_without_content_type_header_in_response(self):
-        self._set_response_fixture({}, 200, 'fake_response_body')
-        self.assertRaises(lib_exc.InvalidContentType,
-                          self.client.json_request, 'GET', '/images')
-
-    def test_json_request_with_xml_content_type_header_in_request(self):
-        self.assertRaises(lib_exc.InvalidContentType,
-                          self.client.json_request, 'GET', '/images',
-                          headers={'Content-Type': 'application/xml'})
-
-    def test_json_request_with_xml_content_type_header_in_response(self):
-        self._set_response_fixture({'content-type': 'application/xml'},
-                                   200, 'fake_response_body')
-        self.assertRaises(lib_exc.InvalidContentType,
-                          self.client.json_request, 'GET', '/images')
-
-    def test_json_request_with_json_content_type_header_only_in_resp(self):
-        self._set_response_fixture({'content-type': 'application/json'},
-                                   200, 'fake_response_body')
-        resp, body = self.client.json_request('GET', '/images')
-        self.assertEqual(200, resp.status)
-        self.assertEqual('fake_response_body', body)
-
-    def test_json_request_with_json_content_type_header_in_req_and_resp(self):
-        self._set_response_fixture({'content-type': 'application/json'},
-                                   200, 'fake_response_body')
-        resp, body = self.client.json_request('GET', '/images', headers={
-            'Content-Type': 'application/json'})
-        self.assertEqual(200, resp.status)
-        self.assertEqual('fake_response_body', body)
-
-    def test_json_request_fails_to_json_loads(self):
-        self._set_response_fixture({'content-type': 'application/json'},
-                                   200, 'fake_response_body')
-        self.useFixture(mockpatch.PatchObject(json, 'loads',
-                        side_effect=ValueError()))
-        resp, body = self.client.json_request('GET', '/images')
-        self.assertEqual(200, resp.status)
-        self.assertEqual(body, 'fake_response_body')
-
-    def test_json_request_socket_timeout(self):
-        self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
-                                              'request',
-                                              side_effect=socket.timeout()))
-        self.assertRaises(exceptions.TimeoutException,
-                          self.client.json_request, 'GET', '/images')
-
-    def test_json_request_endpoint_not_found(self):
-        self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
-                                              'request',
-                                              side_effect=socket.gaierror()))
-        self.assertRaises(exceptions.EndpointNotFound,
-                          self.client.json_request, 'GET', '/images')
-
     def test_raw_request(self):
         self._set_response_fixture({}, 200, 'fake_response_body')
         resp, body = self.client.raw_request('GET', '/images')