def test_update_graphics(self): data = objects.LibvirtLiveMigrateData( graphics_listen_addr_vnc='127.0.0.100', graphics_listen_addr_spice='127.0.0.200') xml = """<domain> <devices> <graphics type="vnc"> <listen type="address" address="127.0.0.1"/> </graphics> <graphics type="spice"> <listen type="address" address="127.0.0.2"/> </graphics> </devices> </domain>""" doc = etree.fromstring(xml) res = etree.tostring(migration._update_graphics_xml(doc, data)) self.assertIn('127.0.0.100', six.text_type(res)) self.assertIn('127.0.0.200', six.text_type(res))
def test_update_graphics(self): data = objects.LibvirtLiveMigrateData( graphics_listen_addr_vnc='127.0.0.100', graphics_listen_addr_spice='127.0.0.200') xml = """<domain> <devices> <graphics type="vnc"> <listen type="address" address="127.0.0.1"/> </graphics> <graphics type="spice"> <listen type="address" address="127.0.0.2"/> </graphics> </devices> </domain>""" doc = etree.fromstring(xml) res = etree.tostring(migration._update_graphics_xml(doc, data)) new_xml = xml.replace("127.0.0.1", "127.0.0.100") new_xml = new_xml.replace("127.0.0.2", "127.0.0.200") self.assertThat(res, matchers.XMLMatches(new_xml))