From ad6c1410e617970b87d94d93d76d06b3778f9428 Mon Sep 17 00:00:00 2001 From: Kenji Ishii Date: Fri, 22 Jan 2016 21:18:38 +0900 Subject: [PATCH] Follow-up patch of bug: #1527457 The patch below was merged before addressing some comments from Akihiro. https://review.openstack.org/#/c/259283/6 This patch will address them. Change-Id: Iaf2aec3265a9f075f434ad5bce8ee6a2e3dd5fc5 Related-Bug: #1527457 --- .../dashboards/identity/domains/workflows.py | 9 ++++----- .../dashboards/identity/projects/tests.py | 1 + openstack_dashboard/test/settings.py | 1 - openstack_dashboard/test/tests/utils.py | 2 ++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/dashboards/identity/domains/workflows.py b/openstack_dashboard/dashboards/identity/domains/workflows.py index f8a1bc4970..666eb13fd6 100644 --- a/openstack_dashboard/dashboards/identity/domains/workflows.py +++ b/openstack_dashboard/dashboards/identity/domains/workflows.py @@ -353,11 +353,10 @@ class UpdateDomain(workflows.Workflow, IdentityMixIn): # domain_id == request.user.domain_id is_current_domain = True - _admin_roles = self.get_admin_roles() - available_admin_role_ids = [role.id for role in - available_roles - if role.name.lower() in - _admin_roles] + available_admin_role_ids = [ + role.id for role in available_roles + if role.name.lower() in self.get_admin_roles() + ] admin_role_ids = [role for role in current_role_ids if role in available_admin_role_ids] if len(admin_role_ids): diff --git a/openstack_dashboard/dashboards/identity/projects/tests.py b/openstack_dashboard/dashboards/identity/projects/tests.py index 3eb85747d9..dc0fa7c183 100644 --- a/openstack_dashboard/dashboards/identity/projects/tests.py +++ b/openstack_dashboard/dashboards/identity/projects/tests.py @@ -1766,6 +1766,7 @@ class SeleniumTests(test.SeleniumAdminTestCase): for user in users: self.assertIn(user.name, members.text) + @override_settings(OPENSTACK_KEYSTONE_ADMIN_ROLES=['foO', 'BAR', 'admin']) def test_get_admin_roles(self): mix_in = workflows.IdentityMixIn() admin_roles = mix_in.get_admin_roles() diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py index 43c13a2a74..20fbfa4209 100644 --- a/openstack_dashboard/test/settings.py +++ b/openstack_dashboard/test/settings.py @@ -232,4 +232,3 @@ REST_API_SETTING_2 = 'bar' REST_API_SECURITY = 'SECURITY' REST_API_REQUIRED_SETTINGS = ['REST_API_SETTING_1'] REST_API_ADDITIONAL_SETTINGS = ['REST_API_SETTING_2'] -OPENSTACK_KEYSTONE_ADMIN_ROLES = ['foO', 'BAR', 'admin'] diff --git a/openstack_dashboard/test/tests/utils.py b/openstack_dashboard/test/tests/utils.py index f07f0986ff..176c6dff68 100644 --- a/openstack_dashboard/test/tests/utils.py +++ b/openstack_dashboard/test/tests/utils.py @@ -14,6 +14,7 @@ # under the License. import datetime +from django.test.utils import override_settings import uuid from openstack_dashboard.test import helpers as test @@ -67,6 +68,7 @@ class UtilsMeteringTests(test.TestCase): class IdentityTests(test.BaseAdminViewTests): + @override_settings(OPENSTACK_KEYSTONE_ADMIN_ROLES=['foO', 'BAR', 'admin']) def test_get_admin_roles(self): mix_in = identity.IdentityMixIn() admin_roles = mix_in.get_admin_roles()