def test_override_role_to_admin_role_at_creating(self): rbac_utils_fixture = self.useFixture( patrole_fixtures.RbacUtilsMixinFixture(do_reset_mocks=False)) test_obj = rbac_utils_fixture.test_obj roles_client = rbac_utils_fixture.admin_roles_client mock_time = rbac_utils_fixture.mock_time roles_client.create_user_role_on_project.assert_called_once_with( rbac_utils_fixture.PROJECT_ID, rbac_utils_fixture.USER_ID, 'admin_id') test_obj.get_auth_providers()[0].clear_auth.assert_called_once_with() test_obj.get_auth_providers()[0].set_auth.assert_called_once_with() mock_time.sleep.assert_called_once_with(1)
def setUp(self): super(PolicyAuthorityTest, self).setUp() mock_admin = self.patchobject(policy_authority.PolicyAuthority, 'os_admin') mock_admin.identity_services_client.list_services.\ return_value = self.services mock_admin.identity_services_v3_client.list_services.\ return_value = self.services current_directory = os.path.dirname(os.path.realpath(__file__)) self.custom_policy_file = os.path.join(current_directory, 'resources', 'custom_rbac_policy.json') self.admin_policy_file = os.path.join(current_directory, 'resources', 'admin_rbac_policy.json') self.alt_admin_policy_file = os.path.join( current_directory, 'resources', 'alt_admin_rbac_policy.json') self.tenant_policy_file = os.path.join(current_directory, 'resources', 'tenant_rbac_policy.json') self.conf_policy_path_json = os.path.join(current_directory, 'resources', '%s.json') self.conf_policy_path_yaml = os.path.join(current_directory, 'resources', '%s.yaml') self.useFixture( fixtures.ConfPatcher( custom_policy_files=[self.conf_policy_path_json], group='patrole')) self.useFixture( fixtures.ConfPatcher(api_v3=True, api_v2=False, group='identity-feature-enabled')) # Guarantee a blank slate for each test. for attr in ('available_services', 'policy_files'): if attr in dir(policy_authority.PolicyAuthority): delattr(policy_authority.PolicyAuthority, attr) self.test_obj = self.useFixture(fixtures.RbacUtilsMixinFixture()).\ test_obj
def setUp(self): super(BaseRBACRuleValidationTest, self).setUp() self.rbac_utils_fixture = self.useFixture( patrole_fixtures.RbacUtilsMixinFixture( rbac_test_roles=self.test_roles)) self.test_obj = self.rbac_utils_fixture.test_obj
def setUp(self): super(RBACUtilsMixinTest, self).setUp() self.rbac_utils_fixture = self.useFixture( patrole_fixtures.RbacUtilsMixinFixture()) self.test_obj = self.rbac_utils_fixture.test_obj