Exemplo n.º 1
0
    def test_get_attribute(self):
        '''
            Verify xml.get_attribute
        '''
        with tempfile.NamedTemporaryFile('w+', delete=False) as xml_file:
            xml_file.write(XML_STRING)
            xml_file.flush()

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

        os.remove(xml_file.name)
Exemplo n.º 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)
Exemplo n.º 3
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)