Example #1
0
    def test_returns_export_of_found_elements(self):
        tag_name = "rsc_some"
        self.create(tag_name, [
            {"ids": ["A", "B"], "options": {"role": "Master"}},
        ])
        self.create(tag_name, [
            {"ids": ["E", "F"], "options": {"action": "start"}},
        ])
        etree.SubElement(self.constraint_section, tag_name).attrib.update({
            "id": "plain1", "is_plain": "true"
        })

        is_plain = lambda element: element.attrib.has_key("is_plain")

        self.assertEqual(
            constraint.show(tag_name, is_plain, self.env), {
            'plain': [{"options": {'id': 'plain1', 'is_plain': 'true'}}],
            'with_resource_sets': [
                {
                    'resource_sets': [{
                        'ids': ['A', 'B'],
                        'options': {'role': 'Master', 'id': 'pcs_rsc_set_A_B'},
                    }],
                    'options': {'symmetrical': 'true', 'id': 'some_id'}
                },
                {
                    'options': {'symmetrical': 'true', 'id': 'some_id'},
                    'resource_sets': [{
                        'ids': ['E', 'F'],
                        'options': {'action': 'start', 'id': 'pcs_rsc_set_E_F'}
                    }]
                }
            ]
        })
    def test_returns_export_of_found_elements(self):
        tag_name = "rsc_some"
        self.create(tag_name, [
            {
                "ids": ["A", "B"],
                "options": {
                    "role": "Master"
                }
            },
        ])
        self.create(tag_name, [
            {
                "ids": ["E", "F"],
                "options": {
                    "action": "start"
                }
            },
        ])
        etree.SubElement(self.constraint_section, tag_name).attrib.update({
            "id":
            "plain1",
            "is_plain":
            "true"
        })

        is_plain = lambda element: element.attrib.has_key("is_plain")

        self.assertEqual(
            constraint.show(tag_name, is_plain, self.env), {
                'plain': [{
                    "options": {
                        'id': 'plain1',
                        'is_plain': 'true'
                    }
                }],
                'with_resource_sets': [{
                    'resource_sets': [{
                        'ids': ['A', 'B'],
                        'options': {
                            'role': 'Master',
                            'id': 'pcs_rsc_set_A_B'
                        },
                    }],
                    'options': {
                        'symmetrical': 'true',
                        'id': 'some_id'
                    }
                }, {
                    'options': {
                        'symmetrical': 'true',
                        'id': 'some_id'
                    },
                    'resource_sets': [{
                        'ids': ['E', 'F'],
                        'options': {
                            'action': 'start',
                            'id': 'pcs_rsc_set_E_F'
                        }
                    }]
                }]
            })
Example #3
0
    def test_returns_export_of_found_elements(self):
        tag_name = "rsc_some"
        self.create(tag_name, [
            {
                "ids": ["A", "B"],
                "options": {
                    "role": "Master"
                }
            },
        ])
        self.create(tag_name, [
            {
                "ids": ["E", "F"],
                "options": {
                    "action": "start"
                }
            },
        ])
        etree.SubElement(self.constraint_section, tag_name).attrib.update({
            "id":
            "plain1",
            "is_plain":
            "true"
        })

        is_plain = lambda element: element.attrib.has_key("is_plain")

        self.assertEqual(
            constraint.show(tag_name, is_plain, self.env),
            {
                "plain": [{
                    "options": {
                        "id": "plain1",
                        "is_plain": "true"
                    }
                }],
                "with_resource_sets": [
                    {
                        "resource_sets": [{
                            "ids": ["A", "B"],
                            "options": {
                                "role": "Master",
                                "id": "some_id_set",
                            },
                        }],
                        "options": {
                            "symmetrical": "true",
                            "id": "some_id"
                        },
                    },
                    {
                        "options": {
                            "symmetrical": "true",
                            "id": "some_id"
                        },
                        "resource_sets": [{
                            "ids": ["E", "F"],
                            "options": {
                                "action": "start",
                                "id": "some_id_set-1",
                            },
                        }],
                    },
                ],
            },
        )