예제 #1
0
파일: test_tag.py 프로젝트: CtrlZmaster/pcs
 def test_remove_a_tag(self):
     lib.remove_tag(
         elem
         for elem in get_tags(self.cib)
         if elem.get("id") == "second_tag"
     )
     assert_xml_equal(FIXTURE_ONE_TAG, etree_to_str(self.cib))
예제 #2
0
파일: tag.py 프로젝트: nrwahl2/pcs
def remove(env: LibraryEnvironment, tag_list: Iterable[str]) -> None:
    """
    Remove specified tags from a cib.

    env -- provides all for communication with externals
    tag_list -- list of tags for the removal
    """
    with cib_tags_section(env) as tags_section:
        env.report_processor.report_list(
            tag.validate_remove_tag(
                get_constraints(get_root(tags_section)), tag_list,
            )
        )
        tag_elements, report_list = tag.find_tag_elements_by_ids(
            tags_section, tag_list,
        )
        if env.report_processor.report_list(report_list).has_errors:
            raise LibraryError()
        tag.remove_tag(tag_elements)
예제 #3
0
파일: test_tag.py 프로젝트: CtrlZmaster/pcs
 def test_remove_more_tags(self):
     lib.remove_tag(elem for elem in get_tags(self.cib))
     assert_xml_equal(
         "<cib><configuration><tags/></configuration></cib>",
         etree_to_str(self.cib),
     )
예제 #4
0
파일: test_tag.py 프로젝트: CtrlZmaster/pcs
 def test_remove_empty_list(self):
     lib.remove_tag([])
     assert_xml_equal(FIXTURE_TWO_TAGS, etree_to_str(self.cib))