Skip to content

Commit

Permalink
Render content-type appropriate 404 (bug 1089987)
Browse files Browse the repository at this point in the history
Change-Id: I8d6acdaa7f8220341bca15cc4acba807910f6891
  • Loading branch information
dolph authored and openstack-gerrit committed Jan 9, 2013
1 parent f75b0e2 commit ec7b94d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keystone/common/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ def _dispatch(req):
"""
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

Expand Down
12 changes: 12 additions & 0 deletions tests/test_content_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,18 @@ def assertValidRole(self, tenant):
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)
Expand Down

0 comments on commit ec7b94d

Please sign in to comment.