[Kimchi-devel] [PATCH V2 2/3] update test case for updating vm with unicode name

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Mon Feb 10 07:48:40 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

update test case for it to avoid regression.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 tests/test_model.py | 6 +++---
 tests/test_rest.py  | 7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/test_model.py b/tests/test_model.py
index 4a6d2fe..ef15be5 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -448,12 +448,12 @@ class ModelTests(unittest.TestCase):
                               'kimchi-vm1', params)
 
             inst.vm_stop('kimchi-vm1')
-            params = {'name': 'new-vm'}
+            params = {'name': u'пeω-∨м'}
             self.assertRaises(OperationFailed, inst.vm_update,
                               'kimchi-vm1', {'name': 'kimchi-vm2'})
             inst.vm_update('kimchi-vm1', params)
-            self.assertEquals(info['uuid'], inst.vm_lookup('new-vm')['uuid'])
-            rollback.prependDefer(inst.vm_delete, 'new-vm')
+            self.assertEquals(info['uuid'], inst.vm_lookup(u'пeω-∨м')['uuid'])
+            rollback.prependDefer(inst.vm_delete, u'пeω-∨м')
 
     @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
     def test_network(self):
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 0ed293b..da2e2b9 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #
 # Project Kimchi
 #
@@ -201,11 +202,11 @@ class RestTests(unittest.TestCase):
         resp = self.request('/vms/vm-1', req, 'PUT')
         self.assertEquals(405, resp.status)
 
-        req = json.dumps({'name': 'vm-updated'})
+        req = json.dumps({'name': u'∨м-црdαtеd'})
         resp = self.request('/vms/vm-1', req, 'PUT')
         self.assertEquals(303, resp.status)
-        vm = json.loads(self.request('/vms/vm-updated', req).read())
-        self.assertEquals('vm-updated', vm['name'])
+        vm = json.loads(self.request('/vms/∨м-црdαtеd', req).read())
+        self.assertEquals(u'∨м-црdαtеd', vm['name'])
 
     def test_vm_lifecycle(self):
         # Create a Template
-- 
1.8.4.2




More information about the Kimchi-devel mailing list