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

Sheldon shaohef at linux.vnet.ibm.com
Tue Feb 11 05:23:29 UTC 2014


On 02/11/2014 08:07 AM, Christy Perez wrote:
>
>
> On Mon, 2014-02-10 at 14:28 +0800, shaohef at linux.vnet.ibm.com wrote:
>> 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
> I've never seen that kind of letter 'i' (ī) before. Is that intentional?
> Does it matter?
yes, intentional.

Characters in "kīмсhī"  are all digraphs, is used for our test.

"kīмсhī"  looks like "kimchi".

If I put Chinese or Portuguese here, maybe others from different 
counties  may not know it.

>
>>               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)
>>   
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list