Render content-type appropriate 404 (bug 1089987)

Change-Id: I8d6acdaa7f8220341bca15cc4acba807910f6891
This commit is contained in:
Dolph Mathews 2012-12-13 10:01:21 -06:00 committed by Gerrit Code Review
parent f75b0e2c39
commit ec7b94d2ef
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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)