Beispiel #1
0
    def test_returns_element_in_dict_representation(self):
        element = etree.Element("resource_set")
        element.attrib.update({"role": "Master"})
        for id in ("A", "B"):
            etree.SubElement(element, "resource_ref").attrib["id"] = id

        self.assertEqual({"options": {"role": "Master"}, "ids": ["A", "B"]}, resource_set.export(element))
Beispiel #2
0
def export_with_set(element):
    return {
        "resource_sets": [
            resource_set.export(resource_set_item)
            for resource_set_item in element.findall(".//resource_set")
        ],
        "options": export_attributes(element),
    }
Beispiel #3
0
def export_with_set(element):
    return {
        "resource_sets": [
            resource_set.export(resource_set_item)
            for resource_set_item in element.findall(".//resource_set")
        ],
        "options": export_attributes(element),
    }
Beispiel #4
0
    def test_returns_element_in_dict_representation(self):
        element = etree.Element("resource_set")
        element.attrib.update({"role": "Master"})
        for id in ("A", "B"):
            etree.SubElement(element, "resource_ref").attrib["id"] = id

        self.assertEqual(
            {'options': {'role': 'Master'}, 'ids': ['A', 'B']},
            resource_set.export(element)
        )
Beispiel #5
0
    def test_returns_element_in_dict_representation(self):
        element = etree.Element("resource_set")
        element.attrib.update({"role": "Master"})
        for _id in ("A", "B"):
            etree.SubElement(element, "resource_ref").attrib["id"] = _id

        self.assertEqual(
            {
                "options": {
                    "role": "Master"
                },
                "ids": ["A", "B"]
            },
            resource_set.export(element),
        )
Beispiel #6
0
    def test_returns_element_in_dict_representation(self):
        element = etree.Element("resource_set")
        element.attrib.update({"role": const.PCMK_ROLE_PROMOTED_LEGACY})
        for _id in ("A", "B"):
            etree.SubElement(element, "resource_ref").attrib["id"] = _id

        self.assertEqual(
            {
                "options": {
                    "role": const.PCMK_ROLE_PROMOTED_PRIMARY
                },
                "ids": ["A", "B"],
            },
            resource_set.export(element),
        )