Skip to content

Commit 43f9370

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "change assert_show_fields to not fail on new fields"
2 parents f140278 + 42ac82b commit 43f9370

3 files changed

Lines changed: 18 additions & 26 deletions

File tree

openstackclient/tests/functional/base.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import subprocess
1717
import testtools
1818

19-
import six
2019
from tempest.lib.cli import output_parser
2120
from tempest.lib import exceptions
2221

@@ -88,23 +87,17 @@ def assert_table_structure(self, items, field_names):
8887
for field in field_names:
8988
self.assertIn(field, item)
9089

91-
def assert_show_fields(self, items, field_names):
90+
def assert_show_fields(self, show_output, field_names):
9291
"""Verify that all items have keys listed in field_names."""
93-
for item in items:
94-
for key in six.iterkeys(item):
95-
self.assertIn(key, field_names)
96-
97-
def assert_show_structure(self, items, field_names):
98-
"""Verify that all field_names listed in keys of all items."""
99-
if isinstance(items, list):
100-
o = {}
101-
for d in items:
102-
o.update(d)
103-
else:
104-
o = items
105-
item_keys = o.keys()
106-
for field in field_names:
107-
self.assertIn(field, item_keys)
92+
93+
# field_names = ['name', 'description']
94+
# show_output = [{'name': 'fc2b98d8faed4126b9e371eda045ade2'},
95+
# {'description': 'description-821397086'}]
96+
# this next line creates a flattened list of all 'keys' (like 'name',
97+
# and 'description' out of the output
98+
all_headers = [item for sublist in show_output for item in sublist]
99+
for field_name in field_names:
100+
self.assertIn(field_name, all_headers)
108101

109102
def parse_show_as_object(self, raw_output):
110103
"""Return a dict with values parsed from cli output."""

openstackclient/tests/functional/identity/v2/common.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
class IdentityTests(base.TestCase):
2323
"""Functional tests for Identity commands. """
2424

25-
USER_FIELDS = ['email', 'enabled', 'id', 'name', 'project_id',
26-
'username', 'domain_id', 'default_project_id']
27-
PROJECT_FIELDS = ['enabled', 'id', 'name', 'description', 'domain_id']
25+
USER_FIELDS = ['email', 'enabled', 'id', 'name', 'project_id', 'username']
26+
PROJECT_FIELDS = ['enabled', 'id', 'name', 'description']
2827
TOKEN_FIELDS = ['expires', 'id', 'project_id', 'user_id']
29-
ROLE_FIELDS = ['id', 'name', 'links', 'domain_id']
28+
ROLE_FIELDS = ['id', 'name', 'domain_id']
3029
SERVICE_FIELDS = ['id', 'enabled', 'name', 'type', 'description']
3130
ENDPOINT_FIELDS = ['id', 'region', 'service_id', 'service_name',
32-
'service_type', 'enabled', 'publicurl',
31+
'service_type', 'publicurl',
3332
'adminurl', 'internalurl']
3433

3534
EC2_CREDENTIALS_FIELDS = ['access', 'project_id', 'secret',

openstackclient/tests/functional/identity/v3/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
class IdentityTests(base.TestCase):
2424
"""Functional tests for Identity commands. """
2525

26-
DOMAIN_FIELDS = ['description', 'enabled', 'id', 'name', 'links']
27-
GROUP_FIELDS = ['description', 'domain_id', 'id', 'name', 'links']
26+
DOMAIN_FIELDS = ['description', 'enabled', 'id', 'name']
27+
GROUP_FIELDS = ['description', 'domain_id', 'id', 'name']
2828
TOKEN_FIELDS = ['expires', 'id', 'project_id', 'user_id']
2929
USER_FIELDS = ['email', 'enabled', 'id', 'name', 'name',
3030
'domain_id', 'default_project_id', 'description',
3131
'password_expires_at']
3232
PROJECT_FIELDS = ['description', 'id', 'domain_id', 'is_domain',
33-
'enabled', 'name', 'parent_id', 'links']
34-
ROLE_FIELDS = ['id', 'name', 'links', 'domain_id']
33+
'enabled', 'name', 'parent_id']
34+
ROLE_FIELDS = ['id', 'name', 'domain_id']
3535
SERVICE_FIELDS = ['id', 'enabled', 'name', 'type', 'description']
3636
REGION_FIELDS = ['description', 'enabled', 'parent_region', 'region']
3737
ENDPOINT_FIELDS = ['id', 'region', 'region_id', 'service_id',

0 commit comments

Comments
 (0)