[Kimchi-devel] [PATCH V2 2/2] update test caset for storage pool support unicode

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Mon Feb 10 06:28:46 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 |  4 ++--
 tests/test_rest.py  | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/test_model.py b/tests/test_model.py
index 4a6d2fe..fe754da 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -186,10 +186,10 @@ class ModelTests(unittest.TestCase):
 
         poolDefs = [
             {'type': 'dir',
-             'name': 'unitTestDirPool',
+             'name': u'kīмсhīUnitTestDirPool',
              'path': '/tmp/kimchi-images'},
             {'type': 'iscsi',
-             'name': 'unitTestISCSIPool',
+             'name': u'kīмсhīUnitTestISCSIPool',
              'source': {'host': '127.0.0.1',
                         'target': 'iqn.2013-12.localhost.kimchiUnitTest'}}]
 
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 0ed293b..c4e92bf 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #
 # Project Kimchi
 #
@@ -588,7 +589,7 @@ class RestTests(unittest.TestCase):
 
         # Now add a couple of StoragePools to the mock model
         for i in xrange(5):
-            name = 'storagepool-%i' % i
+            name = 'kīмсhī-storagepool-%i' % i
             req = json.dumps({'name': name,
                               'capacity': 1024,
                               'allocated': 512,
@@ -597,7 +598,7 @@ class RestTests(unittest.TestCase):
             resp = self.request('/storagepools', req, 'POST')
             self.assertEquals(201, resp.status)
 
-        req = json.dumps({'name': 'storagepool-1',
+        req = json.dumps({'name': 'kīмсhī-storagepool-1',
                           'capacity': 1024,
                           'allocated': 512,
                           'path': '/var/lib/libvirt/images/%i' % i,
@@ -617,9 +618,10 @@ class RestTests(unittest.TestCase):
         storagepools = json.loads(self.request('/storagepools').read())
         self.assertEquals(7, len(storagepools))
 
-        resp = self.request('/storagepools/storagepool-1')
+        resp = self.request('/storagepools/kīмсhī-storagepool-1')
         storagepool = json.loads(resp.read())
-        self.assertEquals('storagepool-1', storagepool['name'])
+        self.assertEquals('kīмсhī-storagepool-1',
+                          storagepool['name'].encode("utf-8"))
         self.assertEquals('inactive', storagepool['state'])
         self.assertIn('source', storagepool)
 
-- 
1.8.4.2




More information about the Kimchi-devel mailing list