# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. import unittest import glob import traceback import virtinst import utils conn = utils.open_testdriver() kvmconn = utils.open_testkvmdriver() def sanitize_file_xml(xml): # s/"/'/g from generated XML, matches what libxml dumps out # This won't work all the time, but should be good enough for testing return xml.replace("'", "\"") class XMLParseTest(unittest.TestCase): def _roundtrip_compare(self, filename): expectXML = sanitize_file_xml(file(filename).read()) guest = virtinst.Guest(conn=conn, parsexml=expectXML) actualXML = guest.get_config_xml() utils.diff_compare(actualXML, expect_out=expectXML)
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. import unittest import glob import traceback import virtinst import utils conn = utils.open_testdriver() kvmconn = utils.open_testkvmdriver() def sanitize_file_xml(xml): # s/"/'/g from generated XML, matches what libxml dumps out # This won't work all the time, but should be good enough for testing return xml.replace("'", "\"") class XMLParseTest(unittest.TestCase): def _roundtrip_compare(self, filename): expectXML = sanitize_file_xml(file(filename).read()) guest = virtinst.Guest(conn=conn, parsexml=expectXML) actualXML = guest.get_config_xml() utils.diff_compare(actualXML, expect_out=expectXML)