diff options
| author | Sami MAKKI <mail@samimakki.fr> | 2018-03-28 16:50:48 +0200 |
|---|---|---|
| committer | Julie Pichon <jpichon@redhat.com> | 2018-09-26 14:22:16 +0100 |
| commit | 212e133e5b3e987b7824bb090e355d5b4cb589a4 (patch) | |
| tree | f62bcb3bb5623f40d8712252227f73898e8402e3 /openstackclient/tests/functional | |
| parent | 8bd810d8f80c5cf76917b0549244ad15f5866144 (diff) | |
| download | python-openstackclient-212e133e5b3e987b7824bb090e355d5b4cb589a4.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.
Conflicts:
openstackclient/tests/unit/identity/v3/fakes.py
Backport note: Also changed the functional test test_implied_role_list
to expect 1 items instead of 3, in line with Queens expectations. The
additional 2 implied roles were only added during Rocky in Keystone
with Ie18a269e3d1075d955fe494acaf634a393c6bd7b.
Story: 2003877
Task: 26736
Change-Id: I08f785dc9e840da2e16915683eecfe49189c44b3
(cherry picked from commit 08dbd154e5da266e44f44386f711a3177e9061bd)
Diffstat (limited to 'openstackclient/tests/functional')
| -rw-r--r-- | openstackclient/tests/functional/identity/v3/common.py | 13 | ||||
| -rw-r--r-- | openstackclient/tests/functional/identity/v3/test_role.py | 25 |
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..9ce5fe51 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(1, 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)) |
