summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/identity
diff options
context:
space:
mode:
authorSami MAKKI <mail@samimakki.fr>2018-03-28 16:50:48 +0200
committerSami MAKKI <mail@samimakki.fr>2018-06-24 02:17:02 +0200
commit08dbd154e5da266e44f44386f711a3177e9061bd (patch)
tree0c6f3c88dd3b1f01c149cee2e20a5d05b9be0fa7 /openstackclient/tests/functional/identity
parent15a079faa6a6cbae465bc96a6069c892af9c0e04 (diff)
downloadpython-openstackclient-08dbd154e5da266e44f44386f711a3177e9061bd.tar.gz
Fix the `role implies list` command.
The code was calling an unexisting function which never existed. The module refers now to the correct `InferenceRuleManager`. It also allows the compatibility with the future python-keystoneclient in which the compatibility method will be removed from the RoleManager. Change-Id: I08f785dc9e840da2e16915683eecfe49189c44b3
Diffstat (limited to 'openstackclient/tests/functional/identity')
-rw-r--r--openstackclient/tests/functional/identity/v3/common.py13
-rw-r--r--openstackclient/tests/functional/identity/v3/test_role.py25
2 files changed, 38 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/identity/v3/common.py b/openstackclient/tests/functional/identity/v3/common.py
index 33cb5d86..54132be5 100644
--- a/openstackclient/tests/functional/identity/v3/common.py
+++ b/openstackclient/tests/functional/identity/v3/common.py
@@ -52,6 +52,8 @@ class IdentityTests(base.TestCase):
'id', 'relay_state_prefix', 'sp_url']
SERVICE_PROVIDER_LIST_HEADERS = ['ID', 'Enabled', 'Description',
'Auth URL']
+ IMPLIED_ROLE_LIST_HEADERS = ['Prior Role ID', 'Prior Role Name',
+ 'Implied Role ID', 'Implied Role Name']
@classmethod
def setUpClass(cls):
@@ -149,6 +151,17 @@ class IdentityTests(base.TestCase):
self.assertEqual(role_name, role['name'])
return role_name
+ def _create_dummy_implied_role(self, add_clean_up=True):
+ role_name = self._create_dummy_role(add_clean_up)
+ implied_role_name = self._create_dummy_role(add_clean_up)
+ self.openstack(
+ 'implied role create '
+ '--implied-role %(implied_role)s '
+ '%(role)s' % {'implied_role': implied_role_name,
+ 'role': role_name})
+
+ return implied_role_name, role_name
+
def _create_dummy_group(self, add_clean_up=True):
group_name = data_utils.rand_name('TestGroup')
description = data_utils.rand_name('description')
diff --git a/openstackclient/tests/functional/identity/v3/test_role.py b/openstackclient/tests/functional/identity/v3/test_role.py
index ab8af9c0..fb9e0614 100644
--- a/openstackclient/tests/functional/identity/v3/test_role.py
+++ b/openstackclient/tests/functional/identity/v3/test_role.py
@@ -143,3 +143,28 @@ class RoleTests(common.IdentityTests):
'role': role_name})
self.assertEqual(0, len(add_raw_output))
self.assertEqual(0, len(remove_raw_output))
+
+ def test_implied_role_list(self):
+ self._create_dummy_implied_role()
+ raw_output = self.openstack('implied role list')
+ items = self.parse_listing(raw_output)
+ self.assert_table_structure(items, self.IMPLIED_ROLE_LIST_HEADERS)
+ self.assertEqual(3, len(items))
+
+ def test_implied_role_create(self):
+ role_name = self._create_dummy_role()
+ implied_role_name = self._create_dummy_role()
+ self.openstack(
+ 'implied role create '
+ '--implied-role %(implied_role)s '
+ '%(role)s' % {'implied_role': implied_role_name,
+ 'role': role_name})
+
+ def test_implied_role_delete(self):
+ implied_role_name, role_name = self._create_dummy_implied_role()
+ raw_output = self.openstack(
+ 'implied role delete '
+ '--implied-role %(implied_role)s '
+ '%(role)s' % {'implied_role': implied_role_name,
+ 'role': role_name})
+ self.assertEqual(0, len(raw_output))