Revision 2af5dc96

b/snf-cyclades-app/synnefo/api/test/versions.py
34 34
from django.utils import simplejson as json
35 35
from django.test import TestCase
36 36
from snf_django.utils.testing import astakos_user
37
from synnefo.cyclades_settings import cyclades_services
38
from synnefo.lib.services import get_service_path
37 39

  
38 40
class APITest(TestCase):
39 41
    def test_api_version(self):
40 42
        """Check API version."""
43
        path = get_service_path(cyclades_services,
44
                                'compute', version='v2.0')
41 45
        with astakos_user('user'):
42
            response = self.client.get('/api/v1.1/')
46
            response = self.client.get(path)
43 47
        self.assertEqual(response.status_code, 200)
44 48
        api_version = json.loads(response.content)['version']
45
        self.assertEqual(api_version['id'], 'v1.1')
49
        self.assertEqual(api_version['id'], 'v2.0')
46 50
        self.assertEqual(api_version['status'], 'CURRENT')
b/snf-cyclades-app/synnefo/api/versions.py
45 45
log = getLogger('synnefo.api')
46 46

  
47 47

  
48
VERSION_1_1 = {
49
    'id': 'v1.1',
50
    'status': 'CURRENT',
51
    'updated': '2011-04-01',
52
    'links': [
48
VERSION_2_0 = {
49
    "id" : "v2.0",
50
    "status" : "CURRENT",
51
    "updated" : "2011-01-21T11:33:21-06:00",
52
    "links": [
53 53
        {
54
            'rel': 'self',
55
            'href': COMPUTE_ROOT_URL,
56
        }
57
    ]
54
            "rel" : "self",
55
            "href" : COMPUTE_ROOT_URL,
56
        },
57
    ],
58 58
}
59 59

  
60
VERSIONS = [VERSION_1_1]
60
VERSIONS = [VERSION_2_0]
61 61

  
62 62
MEDIA_TYPES = [
63
    {'base': 'application/xml',
64
     'type': 'application/vnd.openstack.compute-v1.1+xml'},
65
    {'base': 'application/json',
66
     'type': 'application/vnd.openstack.compute-v1.1+json'}
63
    {
64
        "base" : "application/xml",
65
        "type" : "application/vnd.openstack.compute.v2+xml"
66
    },
67
    {
68
        "base" : "application/json",
69
        "type" : "application/vnd.openstack.compute.v2+json"
70
    }
67 71
]
68 72

  
69 73
DESCRIBED_BY = [
70
    {'rel': 'describedby',
71
     'type': 'application/pdf',
72
     'href': "http://docs.rackspacecloud.com/servers/api/"
73
             "v1.1/cs-devguide-20110125.pdf"},
74
    {'rel': 'describedby',
75
     'type': 'application/vnd.sun.wadl+xml',
76
     'href': "http://docs.rackspacecloud.com/servers/api/v1.1/"
77
             "application.wadl"}
74
    {
75
        "rel" : "describedby",
76
        "type" : "application/pdf",
77
        "href" : "http://docs.rackspacecloud.com/servers/api/v2/cs-devguide-20110125.pdf"
78
    },
79
    {
80
        "rel" : "describedby",
81
        "type" : "application/vnd.sun.wadl+xml",
82
        "href" : "http://docs.rackspacecloud.com/servers/api/v2/application.wadl"
83
    }
78 84
]
79 85

  
80 86

  
......
101 107
    #                       overLimit(413)
102 108

  
103 109
    log.debug('version_details %s', api_version)
104
    # We hardcode to v1.1 since it is the only one we support
105
    version = VERSION_1_1.copy()
110
    # We hardcode to v2.0 since it is the only one we support
111
    version = VERSION_2_0.copy()
106 112
    version['links'] = version['links'] + DESCRIBED_BY
107 113

  
108 114
    if request.serialization == 'xml':

Also available in: Unified diff