summaryrefslogtreecommitdiff
path: root/functional/common/test.py
diff options
context:
space:
mode:
authorGuojian Shao <guojian@unitedstack.com>2015-07-04 21:40:31 +0800
committerGuojian Shao <guojian@unitedstack.com>2015-07-07 15:57:36 +0800
commitaa3b3c1f0f39e05c242ddfc840774d2d23f91b46 (patch)
tree67c426f5f2e1e79fc40d56cd7f1438dd6d96d872 /functional/common/test.py
parent60d1417c2f47006c522c6ed1b973ab3bbb84c69f (diff)
downloadpython-openstackclient-aa3b3c1f0f39e05c242ddfc840774d2d23f91b46.tar.gz
add functional tests for identity v3
To make test cases more clearly, split test_identity.py into test_user.py, test_role, etc. Add more test cases for user, role, etc. Furthermore, to make functional tests run repeatedly without raising duplicated error, clean up resources before exiting each test case. Change-Id: I1541943ad0b8d4d8d1e72822c159fda243b3d1d7 Implements: blueprint identity-functional-tests
Diffstat (limited to 'functional/common/test.py')
-rw-r--r--functional/common/test.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/functional/common/test.py b/functional/common/test.py
index ef034276..50d59fd1 100644
--- a/functional/common/test.py
+++ b/functional/common/test.py
@@ -89,6 +89,26 @@ class TestCase(testtools.TestCase):
for key in six.iterkeys(item):
self.assertIn(key, field_names)
+ def assert_show_structure(self, items, field_names):
+ """Verify that all field_names listed in keys of all items."""
+ if isinstance(items, list):
+ o = {}
+ for d in items:
+ o.update(d)
+ else:
+ o = items
+ item_keys = o.keys()
+ for field in field_names:
+ self.assertIn(field, item_keys)
+
+ def parse_show_as_object(self, raw_output):
+ """Return a dict with values parsed from cli output."""
+ items = self.parse_show(raw_output)
+ o = {}
+ for item in items:
+ o.update(item)
+ return o
+
def parse_show(self, raw_output):
"""Return list of dicts with item values parsed from cli output."""