def test_list_extensions_json(self):
    app = compute.APIRouter()
    request = webob.Request.blank('/fake/extensions')
    response = request.get_response(app)
    self.assertEqual(200, response.status_int)
    data = jsonutils.loads(response.body)
    names = [str(x['name']) for x in data['extensions'] if (str(x['name']) in self.ext_list)]
    names.sort()
    self.assertEqual(names, self.ext_list)
    for ext in data['extensions']:
        iso8601.parse_date(ext['updated'])
    (fox_ext,) = [x for x in data['extensions'] if (x['alias'] == 'FOXNSOX')]
    self.assertEqual(fox_ext, {'namespace': 'http://www.fox.in.socks/api/ext/pie/v1.0', 'name': 'Fox In Socks', 'updated': '2011-01-22T13:25:27-06:00', 'description': 'The Fox In Socks Extension', 'alias': 'FOXNSOX', 'links': []})
    for ext in data['extensions']:
        url = ('/fake/extensions/%s' % ext['alias'])
        request = webob.Request.blank(url)
        response = request.get_response(app)
        output = jsonutils.loads(response.body)
        self.assertEqual(output['extension']['alias'], ext['alias'])
def test_list_extensions_json(self):
    app = compute.APIRouter()
    request = webob.Request.blank('/fake/extensions')
    response = request.get_response(app)
    self.assertEqual(200, response.status_int)
    data = jsonutils.loads(response.body)
    names = [str(x['name']) for x in data['extensions'] if (str(x['name']) in self.ext_list)]
    names.sort()
    self.assertEqual(names, self.ext_list)
    for ext in data['extensions']:
        iso8601.parse_date(ext['updated'])
    (fox_ext,) = [x for x in data['extensions'] if (x['alias'] == 'FOXNSOX')]
    self.assertEqual(fox_ext, {'namespace': 'http://www.fox.in.socks/api/ext/pie/v1.0', 'name': 'Fox In Socks', 'updated': '2011-01-22T13:25:27-06:00', 'description': 'The Fox In Socks Extension', 'alias': 'FOXNSOX', 'links': []})
    for ext in data['extensions']:
        url = ('/fake/extensions/%s' % ext['alias'])
        request = webob.Request.blank(url)
        response = request.get_response(app)
        output = jsonutils.loads(response.body)
        self.assertEqual(output['extension']['alias'], ext['alias'])