From aa3b3c1f0f39e05c242ddfc840774d2d23f91b46 Mon Sep 17 00:00:00 2001 From: Guojian Shao Date: Sat, 4 Jul 2015 21:40:31 +0800 Subject: 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 --- functional/common/test.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'functional/common/test.py') 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.""" -- cgit v1.2.1