Commit a51c9acd authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas

cyclades: fix compute api /versions

parent c56d0588
......@@ -34,13 +34,17 @@
from django.utils import simplejson as json
from django.test import TestCase
from snf_django.utils.testing import astakos_user
from synnefo.cyclades_settings import cyclades_services
from synnefo.lib.services import get_service_path
class APITest(TestCase):
def test_api_version(self):
"""Check API version."""
path = get_service_path(cyclades_services,
'compute', version='v2.0')
with astakos_user('user'):
response = self.client.get('/api/v1.1/')
response = self.client.get(path)
self.assertEqual(response.status_code, 200)
api_version = json.loads(response.content)['version']
self.assertEqual(api_version['id'], 'v1.1')
self.assertEqual(api_version['id'], 'v2.0')
self.assertEqual(api_version['status'], 'CURRENT')
......@@ -45,36 +45,42 @@ from snf_django.lib import api
log = getLogger('synnefo.api')
VERSION_1_1 = {
'id': 'v1.1',
'status': 'CURRENT',
'updated': '2011-04-01',
'links': [
VERSION_2_0 = {
"id" : "v2.0",
"status" : "CURRENT",
"updated" : "2011-01-21T11:33:21-06:00",
"links": [
{
'rel': 'self',
'href': COMPUTE_ROOT_URL,
}
]
"rel" : "self",
"href" : COMPUTE_ROOT_URL,
},
],
}
VERSIONS = [VERSION_1_1]
VERSIONS = [VERSION_2_0]
MEDIA_TYPES = [
{'base': 'application/xml',
'type': 'application/vnd.openstack.compute-v1.1+xml'},
{'base': 'application/json',
'type': 'application/vnd.openstack.compute-v1.1+json'}
{
"base" : "application/xml",
"type" : "application/vnd.openstack.compute.v2+xml"
},
{
"base" : "application/json",
"type" : "application/vnd.openstack.compute.v2+json"
}
]
DESCRIBED_BY = [
{'rel': 'describedby',
'type': 'application/pdf',
'href': "http://docs.rackspacecloud.com/servers/api/"
"v1.1/cs-devguide-20110125.pdf"},
{'rel': 'describedby',
'type': 'application/vnd.sun.wadl+xml',
'href': "http://docs.rackspacecloud.com/servers/api/v1.1/"
"application.wadl"}
{
"rel" : "describedby",
"type" : "application/pdf",
"href" : "http://docs.rackspacecloud.com/servers/api/v2/cs-devguide-20110125.pdf"
},
{
"rel" : "describedby",
"type" : "application/vnd.sun.wadl+xml",
"href" : "http://docs.rackspacecloud.com/servers/api/v2/application.wadl"
}
]
......@@ -101,8 +107,8 @@ def version_details(request, api_version):
# overLimit(413)
log.debug('version_details %s', api_version)
# We hardcode to v1.1 since it is the only one we support
version = VERSION_1_1.copy()
# We hardcode to v2.0 since it is the only one we support
version = VERSION_2_0.copy()
version['links'] = version['links'] + DESCRIBED_BY
if request.serialization == 'xml':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment