diff options
author | Dolph Mathews <dolph.mathews@gmail.com> | 2012-12-13 10:01:21 -0600 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-01-09 19:20:42 +0000 |
commit | ec7b94d2ef008b716f4cc3d7c1fc7e8150858eeb (patch) | |
tree | b0165fa360716b1ed52bc439c83402dd777cb47f | |
parent | f75b0e2c398ddca51359198361834303484624e5 (diff) | |
download | keystone-2012.2.3.tar.gz |
Render content-type appropriate 404 (bug 1089987)2012.2.3
Change-Id: I8d6acdaa7f8220341bca15cc4acba807910f6891
-rw-r--r-- | keystone/common/wsgi.py | 3 | ||||
-rw-r--r-- | tests/test_content_types.py | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py index 91f38d09c..9c133470b 100644 --- a/keystone/common/wsgi.py +++ b/keystone/common/wsgi.py @@ -415,7 +415,8 @@ class Router(object): """ match = req.environ['wsgiorg.routing_args'][1] if not match: - return webob.exc.HTTPNotFound() + return render_exception( + exception.NotFound('The resource could not be found.')) app = match['controller'] return app diff --git a/tests/test_content_types.py b/tests/test_content_types.py index 30db45759..78086e655 100644 --- a/tests/test_content_types.py +++ b/tests/test_content_types.py @@ -312,6 +312,18 @@ class CoreApiTests(object): self.assertIsNotNone(tenant.get('id')) self.assertIsNotNone(tenant.get('name')) + def test_public_not_found(self): + r = self.public_request( + path='/%s' % uuid.uuid4().hex, + expected_status=404) + self.assertValidErrorResponse(r) + + def test_admin_not_found(self): + r = self.admin_request( + path='/%s' % uuid.uuid4().hex, + expected_status=404) + self.assertValidErrorResponse(r) + def test_public_multiple_choice(self): r = self.public_request(path='/', expected_status=300) self.assertValidMultipleChoiceResponse(r) |