summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nova/api/openstack/wsgi.py2
-rw-r--r--nova/tests/unit/api/openstack/compute/legacy_v2/test_servers.py4
-rw-r--r--nova/tests/unit/api/openstack/compute/test_api.py2
-rw-r--r--nova/tests/unit/api/openstack/test_wsgi.py6
4 files changed, 7 insertions, 7 deletions
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index 1c4531cb43..548b469dfb 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -802,7 +802,7 @@ class Resource(wsgi.Application):
contents = self.deserialize(meth, content_type, body)
except exception.InvalidContentType:
msg = _("Unsupported Content-Type")
- return Fault(webob.exc.HTTPBadRequest(explanation=msg))
+ return Fault(webob.exc.HTTPUnsupportedMediaType(explanation=msg))
except exception.MalformedRequestBody:
msg = _("Malformed request body")
return Fault(webob.exc.HTTPBadRequest(explanation=msg))
diff --git a/nova/tests/unit/api/openstack/compute/legacy_v2/test_servers.py b/nova/tests/unit/api/openstack/compute/legacy_v2/test_servers.py
index 4d67b8ed4c..0a42930f41 100644
--- a/nova/tests/unit/api/openstack/compute/legacy_v2/test_servers.py
+++ b/nova/tests/unit/api/openstack/compute/legacy_v2/test_servers.py
@@ -1380,7 +1380,7 @@ class ServersControllerUpdateTest(ControllerTest):
key="Label"></meta>"""
req = self._get_request(body, content_type='xml')
res = req.get_response(fakes.wsgi_app())
- self.assertEqual(400, res.status_int)
+ self.assertEqual(415, res.status_int)
def test_update_server_invalid_xml_raises_expat(self):
body = """<?xml version="1.0" encoding="UTF-8"?>
@@ -1389,7 +1389,7 @@ class ServersControllerUpdateTest(ControllerTest):
key="Label"></meta>"""
req = self._get_request(body, content_type='xml')
res = req.get_response(fakes.wsgi_app())
- self.assertEqual(400, res.status_int)
+ self.assertEqual(415, res.status_int)
def test_update_server_name(self):
body = {'server': {'name': 'server_test'}}
diff --git a/nova/tests/unit/api/openstack/compute/test_api.py b/nova/tests/unit/api/openstack/compute/test_api.py
index 71d1e60fce..1a3b441eb6 100644
--- a/nova/tests/unit/api/openstack/compute/test_api.py
+++ b/nova/tests/unit/api/openstack/compute/test_api.py
@@ -52,7 +52,7 @@ class APITest(test.NoDBTestCase):
req.headers["content-type"] = "application/xml"
res = req.get_response(self.wsgi_app)
- self.assertEqual(res.status_int, 400)
+ self.assertEqual(res.status_int, 415)
def test_vendor_content_type_json(self):
ctype = 'application/vnd.openstack.compute+json'
diff --git a/nova/tests/unit/api/openstack/test_wsgi.py b/nova/tests/unit/api/openstack/test_wsgi.py
index 1494176a45..66d95eb46c 100644
--- a/nova/tests/unit/api/openstack/test_wsgi.py
+++ b/nova/tests/unit/api/openstack/test_wsgi.py
@@ -418,9 +418,9 @@ class ResourceTest(test.NoDBTestCase):
req.content_type = None
req.body = '{"body": {"key": "value"}}'
response = req.get_response(app)
- expected_unsupported_type_body = {'badRequest':
- {'message': 'Unsupported Content-Type', 'code': 400}}
- self.assertEqual(response.status_int, 400)
+ expected_unsupported_type_body = {'badMediaType':
+ {'message': 'Unsupported Content-Type', 'code': 415}}
+ self.assertEqual(response.status_int, 415)
self.assertEqual(expected_unsupported_type_body,
jsonutils.loads(response.body))