diff --git a/glanceclient/tests/unit/v2/test_shell_v2.py b/glanceclient/tests/unit/v2/test_shell_v2.py index d5868055..45200ca1 100644 --- a/glanceclient/tests/unit/v2/test_shell_v2.py +++ b/glanceclient/tests/unit/v2/test_shell_v2.py @@ -301,6 +301,26 @@ class ShellV2Test(testtools.TestCase): except Exception: 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',