Change tempest InvalidContentType exc to tempest-lib exc

This commit changes tempest.exceptions.InvalidContentType to
tempest_lib.exceptions.InvalidContentType. This is one of the migrating
rest client to tempest-lib works.

Change-Id: Ia50f62ab80df3a8f0a3c045ed8b22465566cff30
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 92ed8f1..dd1448a 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -29,6 +29,7 @@
 
 import OpenSSL
 from six import moves
+from tempest_lib import exceptions as lib_exc
 
 from tempest import exceptions as exc
 from tempest.openstack.common import log as logging
@@ -164,7 +165,7 @@
         kwargs['headers'].setdefault('Content-Type', 'application/json')
         if kwargs['headers']['Content-Type'] != 'application/json':
             msg = "Only application/json content-type is supported."
-            raise exc.InvalidContentType(msg)
+            raise lib_exc.InvalidContentType(msg)
 
         if 'body' in kwargs:
             kwargs['body'] = json.dumps(kwargs['body'])
@@ -179,7 +180,7 @@
                 LOG.error('Could not decode response body as JSON')
         else:
             msg = "Only json/application content-type is supported."
-            raise exc.InvalidContentType(msg)
+            raise lib_exc.InvalidContentType(msg)
 
         return resp, body
 
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index 513098e..69e25e2 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -69,8 +69,6 @@
             raise exceptions.Conflict(ex)
         except lib_exceptions.OverLimit as ex:
             raise exceptions.OverLimit(ex)
-        except lib_exceptions.InvalidContentType as ex:
-            raise exceptions.InvalidContentType(ex)
         # TODO(oomichi): This is just a workaround for failing gate tests
         # when separating Forbidden from Unauthorized in tempest-lib.
         # We will need to remove this translation and replace negative tests
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 3b5fedb..7ddeeff 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -185,10 +185,6 @@
     message = "HTTP response header is invalid"
 
 
-class InvalidContentType(RestClientException):
-    message = "Invalid content type provided"
-
-
 class InvalidStructure(TempestException):
     message = "Invalid structure of table with details"
 
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index c92a886..852dd4b 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -19,6 +19,7 @@
 
 import mock
 import six
+from tempest_lib import exceptions as lib_exc
 
 from tempest.common import glance_http
 from tempest import exceptions
@@ -57,18 +58,18 @@
 
     def test_json_request_without_content_type_header_in_response(self):
         self._set_response_fixture({}, 200, 'fake_response_body')
-        self.assertRaises(exceptions.InvalidContentType,
+        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(exceptions.InvalidContentType,
+        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(exceptions.InvalidContentType,
+        self.assertRaises(lib_exc.InvalidContentType,
                           self.client.json_request, 'GET', '/images')
 
     def test_json_request_with_json_content_type_header_only_in_resp(self):