def test_success(self): lib.remove_target(self.cib.tree, "target1") self.assert_cib_equal(self.create_cib().append_to_first_tag_name( "configuration", """ <acls> <acl_role id="target2"/> </acls> """))
def remove_target(lib_env, target_id): """ Remove acl_target element with id target_id. Raises LibraryError on any failure. lib_env -- LibraryEnvironment target_id -- id of taget which should be removed """ with cib_acl_section(lib_env) as acl_section: acl.remove_target(acl_section, target_id)
def test_success(self): lib.remove_target(self.cib.tree, "target1") self.assert_cib_equal(self.create_cib().append_to_first_tag_name( "configuration", """ <acls> <acl_role id="target2"/> </acls> """ ))
def remove_target(lib_env, target_id): """ Remove acl_target element with id target_id. Raises LibraryError on any failure. lib_env -- LibraryEnvironment target_id -- id of taget which should be removed """ cib = lib_env.get_cib(REQUIRED_CIB_VERSION) acl.remove_target(cib, target_id) lib_env.push_cib(cib)
def test_not_existing(self): assert_raise_library_error( lambda: lib.remove_target(self.acls, "target2"), (severities.ERROR, report_codes.ID_BELONGS_TO_UNEXPECTED_TYPE, { "id": "target2", "expected_types": ["acl_target"], "current_type": "acl_role", }))
def test_not_existing(self): assert_raise_library_error( lambda: lib.remove_target(self.cib.tree, "target2"), ( severities.ERROR, report_codes.ID_NOT_FOUND, {"id": "target2"} ) )
def test_not_existing(self): assert_raise_library_error( lambda: lib.remove_target(self.acls, "target2"), ( severities.ERROR, report_codes.ID_BELONGS_TO_UNEXPECTED_TYPE, { "id": "target2", "expected_types": ["acl_target"], "current_type": "acl_role", } ) )