示例#1
0
    def test_set_attribute(self):
        '''
            Verify xml.set_value
        '''
        with tempfile.NamedTemporaryFile('w+', delete=False) as xml_file:
            xml_file.write(XML_STRING)
            xml_file.flush()

        xml_result = xml.set_attribute(xml_file.name, ".//actor[@id='3']",
                                       "edited", "uh-huh")
        assert xml_result is True

        xml_result = xml.get_attribute(xml_file.name, ".//actor[@id='3']")
        self.assertEqual(xml_result, {'edited': 'uh-huh', 'id': '3'})

        os.remove(xml_file.name)
示例#2
0
    def test_set_attribute(self):
        """
        Verify xml.set_value
        """
        with tempfile.NamedTemporaryFile("w+", delete=False) as xml_file:
            xml_file.write(XML_STRING)
            xml_file.flush()

        xml_result = xml.set_attribute(xml_file.name, ".//actor[@id='3']",
                                       "edited", "uh-huh")
        assert xml_result is True

        xml_result = xml.get_attribute(xml_file.name, ".//actor[@id='3']")
        self.assertEqual(xml_result, {"edited": "uh-huh", "id": "3"})

        os.remove(xml_file.name)