예제 #1
0
 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)
예제 #2
0
 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'))
예제 #3
0
 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
     )
예제 #4
0
 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')
     )