[Kimchi-devel] [PATCH 9/9] Template_test: check assert that verifies the vm name

Ramon Medeiros ramonn at linux.vnet.ibm.com
Thu May 7 17:40:39 UTC 2015


The test was checking the name directly, which is wrong, due special
characters imcompatibility. So, if title is present, use it.

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 tests/test_vmtemplate.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/test_vmtemplate.py b/tests/test_vmtemplate.py
index b504fbc..4df1c7f 100644
--- a/tests/test_vmtemplate.py
+++ b/tests/test_vmtemplate.py
@@ -86,7 +86,13 @@ class VMTemplateTests(unittest.TestCase):
         t = VMTemplate({'name': 'test-template', 'cdrom': self.iso})
         xml = t.to_vm_xml('test-vm', vm_uuid, graphics=graphics)
         self.assertEquals(vm_uuid, xpath_get_text(xml, "/domain/uuid")[0])
-        self.assertEquals('test-vm', xpath_get_text(xml, "/domain/name")[0])
+
+        name = xpath_get_text(xml, "/domain/name")[0]
+        title = xpath_get_text(xml, "/domain/title")
+        if len(title) > 0:
+            name = title[0]
+
+        self.assertEquals('test-vm', name)
         expr = "/domain/devices/graphics/@type"
         self.assertEquals(graphics['type'], xpath_get_text(xml, expr)[0])
         expr = "/domain/devices/graphics/@listen"
-- 
2.1.0




More information about the Kimchi-devel mailing list