Skip to content

Commit 6c4f815

Browse files
author
Steve Martinelli
committed
Re-organize functional tests
The tests should be further divded by project version, similar to the structure of the unit tests. Change-Id: Ied3a4204983cdd253c5602a60968c066038d88f2
1 parent 6ce930e commit 6c4f815

10 files changed

Lines changed: 95 additions & 79 deletions

File tree

‎functional/tests/examples/__init__.py‎

Whitespace-only changes.
File renamed without changes.

‎functional/tests/identity/__init__.py‎

Whitespace-only changes.

‎functional/tests/identity/v2/__init__.py‎

Whitespace-only changes.

functional/tests/test_identity.py renamed to functional/tests/identity/v2/test_identity.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
# License for the specific language governing permissions and limitations
1111
# under the License.
1212

13-
import os
14-
import uuid
15-
1613
from functional.common import exceptions
1714
from functional.common import test
1815

@@ -115,79 +112,3 @@ def test_ec2_credentials_show(self):
115112
'ec2 credentials delete %s' % create_items[0]['access'],
116113
)
117114
self.assert_show_fields(items, self.EC2_CREDENTIALS_FIELDS)
118-
119-
120-
class IdentityV3Tests(test.TestCase):
121-
"""Functional tests for Identity V3 commands. """
122-
123-
DOMAIN_FIELDS = ['description', 'enabled', 'id', 'name', 'links']
124-
GROUP_FIELDS = ['description', 'domain_id', 'id', 'name', 'links']
125-
TOKEN_FIELDS = ['expires', 'id', 'project_id', 'user_id']
126-
127-
def _create_dummy_group(self):
128-
name = uuid.uuid4().hex
129-
self.openstack('group create ' + name)
130-
return name
131-
132-
def _create_dummy_domain(self):
133-
name = uuid.uuid4().hex
134-
self.openstack('domain create ' + name)
135-
return name
136-
137-
def setUp(self):
138-
super(IdentityV3Tests, self).setUp()
139-
auth_url = os.environ.get('OS_AUTH_URL')
140-
auth_url = auth_url.replace('v2.0', 'v3')
141-
os.environ['OS_AUTH_URL'] = auth_url
142-
os.environ['OS_IDENTITY_API_VERSION'] = '3'
143-
os.environ['OS_USER_DOMAIN_ID'] = 'default'
144-
os.environ['OS_PROJECT_DOMAIN_ID'] = 'default'
145-
146-
def test_group_create(self):
147-
raw_output = self.openstack('group create ' + uuid.uuid4().hex)
148-
items = self.parse_show(raw_output)
149-
self.assert_show_fields(items, self.GROUP_FIELDS)
150-
151-
def test_group_list(self):
152-
self._create_dummy_group()
153-
raw_output = self.openstack('group list')
154-
items = self.parse_listing(raw_output)
155-
self.assert_table_structure(items, BASIC_LIST_HEADERS)
156-
157-
def test_group_delete(self):
158-
name = self._create_dummy_group()
159-
raw_output = self.openstack('group delete ' + name)
160-
self.assertEqual(0, len(raw_output))
161-
162-
def test_group_show(self):
163-
name = self._create_dummy_group()
164-
raw_output = self.openstack('group show ' + name)
165-
items = self.parse_show(raw_output)
166-
self.assert_show_fields(items, self.GROUP_FIELDS)
167-
168-
def test_domain_create(self):
169-
raw_output = self.openstack('domain create ' + uuid.uuid4().hex)
170-
items = self.parse_show(raw_output)
171-
self.assert_show_fields(items, self.DOMAIN_FIELDS)
172-
173-
def test_domain_list(self):
174-
self._create_dummy_domain()
175-
raw_output = self.openstack('domain list')
176-
items = self.parse_listing(raw_output)
177-
self.assert_table_structure(items, BASIC_LIST_HEADERS)
178-
179-
def test_domain_delete(self):
180-
name = self._create_dummy_domain()
181-
self.assertRaises(exceptions.CommandFailed,
182-
self.openstack, 'domain delete ' + name)
183-
184-
def test_domain_show(self):
185-
name = self._create_dummy_domain()
186-
raw_output = self.openstack('domain show ' + name)
187-
items = self.parse_show(raw_output)
188-
self.assert_show_fields(items, self.DOMAIN_FIELDS)
189-
190-
def test_token_issue(self):
191-
raw_output = self.openstack('token issue')
192-
items = self.parse_show(raw_output)
193-
self.assert_show_fields(items, self.TOKEN_FIELDS)

‎functional/tests/identity/v3/__init__.py‎

Whitespace-only changes.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
import os
14+
import uuid
15+
16+
from functional.common import exceptions
17+
from functional.common import test
18+
19+
BASIC_LIST_HEADERS = ['ID', 'Name']
20+
21+
22+
class IdentityV3Tests(test.TestCase):
23+
"""Functional tests for Identity V3 commands. """
24+
25+
DOMAIN_FIELDS = ['description', 'enabled', 'id', 'name', 'links']
26+
GROUP_FIELDS = ['description', 'domain_id', 'id', 'name', 'links']
27+
TOKEN_FIELDS = ['expires', 'id', 'project_id', 'user_id']
28+
29+
def _create_dummy_group(self):
30+
name = uuid.uuid4().hex
31+
self.openstack('group create ' + name)
32+
return name
33+
34+
def _create_dummy_domain(self):
35+
name = uuid.uuid4().hex
36+
self.openstack('domain create ' + name)
37+
return name
38+
39+
def setUp(self):
40+
super(IdentityV3Tests, self).setUp()
41+
auth_url = os.environ.get('OS_AUTH_URL')
42+
auth_url = auth_url.replace('v2.0', 'v3')
43+
os.environ['OS_AUTH_URL'] = auth_url
44+
os.environ['OS_IDENTITY_API_VERSION'] = '3'
45+
os.environ['OS_USER_DOMAIN_ID'] = 'default'
46+
os.environ['OS_PROJECT_DOMAIN_ID'] = 'default'
47+
48+
def test_group_create(self):
49+
raw_output = self.openstack('group create ' + uuid.uuid4().hex)
50+
items = self.parse_show(raw_output)
51+
self.assert_show_fields(items, self.GROUP_FIELDS)
52+
53+
def test_group_list(self):
54+
self._create_dummy_group()
55+
raw_output = self.openstack('group list')
56+
items = self.parse_listing(raw_output)
57+
self.assert_table_structure(items, BASIC_LIST_HEADERS)
58+
59+
def test_group_delete(self):
60+
name = self._create_dummy_group()
61+
raw_output = self.openstack('group delete ' + name)
62+
self.assertEqual(0, len(raw_output))
63+
64+
def test_group_show(self):
65+
name = self._create_dummy_group()
66+
raw_output = self.openstack('group show ' + name)
67+
items = self.parse_show(raw_output)
68+
self.assert_show_fields(items, self.GROUP_FIELDS)
69+
70+
def test_domain_create(self):
71+
raw_output = self.openstack('domain create ' + uuid.uuid4().hex)
72+
items = self.parse_show(raw_output)
73+
self.assert_show_fields(items, self.DOMAIN_FIELDS)
74+
75+
def test_domain_list(self):
76+
self._create_dummy_domain()
77+
raw_output = self.openstack('domain list')
78+
items = self.parse_listing(raw_output)
79+
self.assert_table_structure(items, BASIC_LIST_HEADERS)
80+
81+
def test_domain_delete(self):
82+
name = self._create_dummy_domain()
83+
self.assertRaises(exceptions.CommandFailed,
84+
self.openstack, 'domain delete ' + name)
85+
86+
def test_domain_show(self):
87+
name = self._create_dummy_domain()
88+
raw_output = self.openstack('domain show ' + name)
89+
items = self.parse_show(raw_output)
90+
self.assert_show_fields(items, self.DOMAIN_FIELDS)
91+
92+
def test_token_issue(self):
93+
raw_output = self.openstack('token issue')
94+
items = self.parse_show(raw_output)
95+
self.assert_show_fields(items, self.TOKEN_FIELDS)

‎functional/tests/object/__init__.py‎

Whitespace-only changes.

‎functional/tests/object/v1/__init__.py‎

Whitespace-only changes.

0 commit comments

Comments
 (0)