def test_skip_without_placeholders(self): # any domain without placeholders is fine, picked random one xml_str = read_data('vm_hosted_engine_42.xml') dom = xmlutils.fromstring(xml_str) with MonkeyPatchScope([ (osinfo, 'version', self._version), ]): domxml_preprocess.replace_placeholders(dom, cpuarch.X86_64, serial='test-serial') self.assertXMLEqual(xmlutils.tostring(dom, pretty=True), xml_str)
def test_replace_values(self): xml_str = read_data('sysinfo_snippet_template.xml') dom = xmlutils.fromstring(xml_str) with MonkeyPatchScope([ (osinfo, 'version', self._version), ]): domxml_preprocess.replace_placeholders(dom, cpuarch.X86_64, serial='test-serial') self.assertXMLEqual(xmlutils.tostring(dom, pretty=True), read_data('sysinfo_snippet_filled.xml'))
def test_skip_without_placeholders(self): # any domain without placeholders is fine, picked random one xml_str = read_data('vm_hosted_engine_42.xml') dom = xmlutils.fromstring(xml_str) with MonkeyPatchScope([ (osinfo, 'version', self._version), ]): domxml_preprocess.replace_placeholders( dom, cpuarch.X86_64, serial='test-serial') self.assertXMLEqual( xmlutils.tostring(dom, pretty=True), xml_str )
def test_replace_values(self): xml_str = read_data('sysinfo_snippet_template.xml') dom = xmlutils.fromstring(xml_str) with MonkeyPatchScope([ (osinfo, 'version', self._version), (constants, 'SMBIOS_OSNAME', 'test-product'), ]): domxml_preprocess.replace_placeholders( dom, cpuarch.X86_64, serial='test-serial') self.assertXMLEqual( xmlutils.tostring(dom, pretty=True), read_data('sysinfo_snippet_filled.xml') )