def test_success(self, assign_role): assign_role.return_value = [] lib.assign_all_roles("acl_section", ["1", "2", "3"], "element") assign_role.assert_has_calls([ mock.call("acl_section", "1", "element"), mock.call("acl_section", "2", "element"), mock.call("acl_section", "3", "element"), ], any_order=True)
def test_success(self, assign_role): assign_role.return_value = [] lib.assign_all_roles("acl_section", ["1", "2", "3"], "element") assign_role.assert_has_calls([ mock.call("acl_section", "1", "element"), mock.call("acl_section", "2", "element"), mock.call("acl_section", "3", "element"), ], any_order=True)
def create_group(lib_env, group_id, role_list): """ Create new group with id group_id and assign roles role_list to it. Raises LibraryError on any failure. lib_env -- LibraryEnvironment group_id -- id of new group role_list -- list of roles to assign to new group """ with cib_acl_section(lib_env) as acl_section: acl.assign_all_roles(acl_section, role_list, acl.create_group(acl_section, group_id))
def create_target(lib_env, target_id, role_list): """ Create new target with id target_id and assign roles role_list to it. Raises LibraryError on any failure. lib_env -- LibraryEnvironment target_id -- id of new target role_list -- list of roles to assign to new target """ with cib_acl_section(lib_env) as acl_section: acl.assign_all_roles(acl_section, role_list, acl.create_target(acl_section, target_id))
def create_group(lib_env, group_id, role_list): """ Create new group with id group_id and assign roles role_list to it. Raises LibraryError on any failure. lib_env -- LibraryEnvironment group_id -- id of new group role_list -- list of roles to assign to new group """ with cib_acl_section(lib_env) as acl_section: acl.assign_all_roles( acl_section, role_list, acl.create_group(acl_section, group_id) )
def create_target(lib_env, target_id, role_list): """ Create new target with id target_id and assign roles role_list to it. Raises LibraryError on any failure. lib_env -- LibraryEnvironment target_id -- id of new target role_list -- list of roles to assign to new target """ with cib_acl_section(lib_env) as acl_section: acl.assign_all_roles( acl_section, role_list, acl.create_target(acl_section, target_id) )
def test_fail_on_error_report(self, assign_role): assign_role.return_value = ['report'] self.assertRaises( LibraryError, lambda: lib.assign_all_roles("acl_section", ["1", "2", "3"], "element") )
def test_fail_on_error_report(self, assign_role): assign_role.return_value = ['report'] self.assertRaises( LibraryError, lambda: lib.assign_all_roles("acl_section", ["1", "2", "3"], "element") )