normalize the json output of show a given extension.

we should use {'extension':{}} for a given extension query to comply with
our API design.

Change-Id: Id0b04b29bed4be92498c04178e268c31e9a1d635
This commit is contained in:
Yong Sheng Gong 2012-08-12 07:50:22 +08:00
parent ce8f2bd61d
commit b614183592
2 changed files with 2 additions and 2 deletions

View File

@ -221,7 +221,7 @@ class ExtensionController(wsgi.Controller):
if not ext: if not ext:
raise webob.exc.HTTPNotFound( raise webob.exc.HTTPNotFound(
_("Extension with alias %s does not exist") % id) _("Extension with alias %s does not exist") % id)
return self._translate(ext) return dict(extension=self._translate(ext))
def delete(self, request, id): def delete(self, request, id):
raise webob.exc.HTTPNotFound() raise webob.exc.HTTPNotFound()

View File

@ -454,7 +454,7 @@ class ExtensionControllerTest(unittest.TestCase):
def test_extension_can_be_accessed_by_alias(self): def test_extension_can_be_accessed_by_alias(self):
foxnsox_extension = self.test_app.get("/extensions/FOXNSOX").json foxnsox_extension = self.test_app.get("/extensions/FOXNSOX").json
foxnsox_extension = foxnsox_extension['extension']
self.assertEqual(foxnsox_extension["alias"], "FOXNSOX") self.assertEqual(foxnsox_extension["alias"], "FOXNSOX")
self.assertEqual(foxnsox_extension["namespace"], self.assertEqual(foxnsox_extension["namespace"],
"http://www.fox.in.socks/api/ext/pie/v1.0") "http://www.fox.in.socks/api/ext/pie/v1.0")