Merge "Added unit tests for 'Unicode support shell client'"
This commit is contained in:
commit
c567edc2b2
@ -400,6 +400,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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user