Handle HTTP 415 in rest_client

If HTTP 415 ("Unsupported Media Type") is returned then,
rest_client responds with an "UnexpectedResponseCode" exception.

Tempest always send request with supported media type and that's
why 415 did not happen.
But as rest_client is on the way to be part of tempest-lib,
its better to handle 415 and raise appropriate error.

This patch handle HTTP 415 error and raise 'InvalidContentType'.

Change-Id: I72690aab7afd8e68f054f31315a8b1576a7ec9c4
Closes-Bug: #1407140
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index ca87a75..7af1e23 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -494,6 +494,11 @@
             else:
                 raise exceptions.RateLimitExceeded(resp_body)
 
+        if resp.status == 415:
+            if parse_resp:
+                resp_body = self._parse_resp(resp_body)
+            raise exceptions.InvalidContentType(resp_body)
+
         if resp.status == 422:
             if parse_resp:
                 resp_body = self._parse_resp(resp_body)
diff --git a/tempest/tests/test_rest_client.py b/tempest/tests/test_rest_client.py
index 42ba5a0..8d933df 100644
--- a/tempest/tests/test_rest_client.py
+++ b/tempest/tests/test_rest_client.py
@@ -339,6 +339,11 @@
                           self.rest_client._error_checker,
                           **self.set_data("413"))
 
+    def test_response_415(self):
+        self.assertRaises(exceptions.InvalidContentType,
+                          self.rest_client._error_checker,
+                          **self.set_data("415"))
+
     def test_response_422(self):
         self.assertRaises(exceptions.UnprocessableEntity,
                           self.rest_client._error_checker,