summaryrefslogtreecommitdiff
path: root/glanceclient/tests/unit
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-10-09 16:20:37 +0000
committerGerrit Code Review <review@openstack.org>2015-10-09 16:20:37 +0000
commitc567edc2b256cfc3d2ac6d31ea630b136739280b (patch)
tree7688eedb9a5ec02c69aa7d77ea2701006ca8e35e /glanceclient/tests/unit
parent77012ee670bea5f2d801f158744de6c83b10f649 (diff)
parentabf0381e366e08b08e63583870596fc9b325a850 (diff)
downloadpython-glanceclient-c567edc2b256cfc3d2ac6d31ea630b136739280b.tar.gz
Merge "Added unit tests for 'Unicode support shell client'"
Diffstat (limited to 'glanceclient/tests/unit')
-rw-r--r--glanceclient/tests/unit/v2/test_shell_v2.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/glanceclient/tests/unit/v2/test_shell_v2.py b/glanceclient/tests/unit/v2/test_shell_v2.py
index 39699ce..a68ffb2 100644
--- a/glanceclient/tests/unit/v2/test_shell_v2.py
+++ b/glanceclient/tests/unit/v2/test_shell_v2.py
@@ -401,6 +401,26 @@ class ShellV2Test(testtools.TestCase):
pass
@mock.patch('sys.stdin', autospec=True)
+ def test_do_image_create_with_unicode(self, mock_stdin):
+ name = u'\u041f\u0420\u0418\u0412\u0415\u0422\u0418\u041a'
+
+ args = self._make_args({'name': name,
+ 'file': None})
+ with mock.patch.object(self.gc.images, 'create') as mocked_create:
+ ignore_fields = ['self', 'access', 'file', 'schema']
+ expect_image = dict((field, field) for field in ignore_fields)
+ expect_image['id'] = 'pass'
+ expect_image['name'] = name
+ mocked_create.return_value = expect_image
+
+ mock_stdin.isatty = lambda: True
+ test_shell.do_image_create(self.gc, args)
+
+ mocked_create.assert_called_once_with(name=name)
+ utils.print_dict.assert_called_once_with({
+ 'id': 'pass', 'name': name})
+
+ @mock.patch('sys.stdin', autospec=True)
def test_do_image_create_with_user_props(self, mock_stdin):
args = self._make_args({'name': 'IMG-01',
'property': ['myprop=myval'],