Debian Codegraph @

glanceclient/tests/unit/v2/test_versions.py

raw symbols SCIP
1 # Copyright 2015 OpenStack Foundation
2 # Copyright 2015 Huawei Corp.
3 # All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
15 # under the License.
16
17 import testtools
18
19 from glanceclient.tests import utils
20 from glanceclient.v2 import versions
21
22 fixtures = {
23 '/versions': {
24 'GET': (
25 {},
26 {"versions": [
27 {
28 "status": "EXPERIMENTAL",
29 "id": "v3.0",
30 "links": [
31 {
32 "href": "http://10.229.45.145:9292/v3/",
33 "rel": "self"
34 }
35 ]
36 },
37 {
38 "status": "CURRENT",
39 "id": "v2.3",
40 "links": [
41 {
42 "href": "http://10.229.45.145:9292/v2/",
43 "rel": "self"
44 }
45 ]
46 },
47 {
48 "status": "SUPPORTED",
49 "id": "v1.0",
50 "links": [
51 {
52 "href": "http://10.229.45.145:9292/v1/",
53 "rel": "self"
54 }
55 ]
56 }
57 ]}
58 )
59 }
60 }
61
62
63 class TestVersions(testtools.TestCase):
64
65 def setUp(self):
66 super(TestVersions, self).setUp()
67 self.api = utils.FakeAPI(fixtures)
68 self.controller = versions.VersionController(self.api)
69
70 def test_version_list(self):
71 version = list(self.controller.list())
72 self.assertEqual('v3.0', version[0]['id'])
73 self.assertEqual('EXPERIMENTAL', version[0]['status'])
74 self.assertEqual([{"href": "http://10.229.45.145:9292/v3/",
75 "rel": "self"}], version[0]['links'])