Debian Codegraph @

keystoneclient/tests/unit/v2_0/test_extensions.py

raw symbols SCIP
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12
13 from keystoneclient.tests.unit.v2_0 import utils
14 from keystoneclient.v2_0 import extensions
15
16
17 class ExtensionTests(utils.ClientTestCase):
18 def setUp(self):
19 super(ExtensionTests, self).setUp()
20 self.TEST_EXTENSIONS = {
21 'extensions': {
22 "values": [
23 {
24 'name': 'OpenStack Keystone User CRUD',
25 'namespace': 'https://docs.openstack.org/'
26 'identity/api/ext/OS-KSCRUD/v1.0',
27 'updated': '2013-07-07T12:00:0-00:00',
28 'alias': 'OS-KSCRUD',
29 'description':
30 'OpenStack extensions to Keystone v2.0 API'
31 ' enabling User Operations.',
32 'links':
33 '[{"href":'
34 '"https://github.com/openstack/identity-api", "type":'
35 ' "text/html", "rel": "describedby"}]',
36 },
37 {
38 'name': 'OpenStack EC2 API',
39 'namespace': 'https://docs.openstack.org/'
40 'identity/api/ext/OS-EC2/v1.0',
41 'updated': '2013-09-07T12:00:0-00:00',
42 'alias': 'OS-EC2',
43 'description': 'OpenStack EC2 Credentials backend.',
44 'links': '[{"href":'
45 '"https://github.com/openstack/identity-api", "type":'
46 ' "text/html", "rel": "describedby"}]',
47 }
48 ]
49 }
50 }
51
52 def test_list(self):
53 self.stub_url('GET', ['extensions'], json=self.TEST_EXTENSIONS)
54 extensions_list = self.client.extensions.list()
55 self.assertEqual(2, len(extensions_list))
56 for extension in extensions_list:
57 self.assertIsInstance(extension, extensions.Extension)
58 self.assertIsNotNone(extension.alias)
59 self.assertIsNotNone(extension.description)
60 self.assertIsNotNone(extension.links)
61 self.assertIsNotNone(extension.name)
62 self.assertIsNotNone(extension.namespace)
63 self.assertIsNotNone(extension.updated)