Merge "Fix tests for image-create"

This commit is contained in:
Jenkins
2015-12-03 13:34:23 +00:00
committed by Gerrit Code Review

View File

@@ -122,23 +122,19 @@ class ShellV2Test(testtools.TestCase):
@mock.patch('sys.stderr') @mock.patch('sys.stderr')
def test_image_create_missing_disk_format(self, __): def test_image_create_missing_disk_format(self, __):
# We test for all possible sources e = self.assertRaises(exc.CommandError, self._run_command,
for origin in ('--file', '--location', '--copy-from'): '--os-image-api-version 2 image-create ' +
e = self.assertRaises(exc.CommandError, self._run_command, '--file fake_src --container-format bare')
'--os-image-api-version 2 image-create ' + self.assertEqual('error: Must provide --disk-format when using '
origin + ' fake_src --container-format bare') '--file.', e.message)
self.assertEqual('error: Must provide --disk-format when using '
+ origin + '.', e.message)
@mock.patch('sys.stderr') @mock.patch('sys.stderr')
def test_image_create_missing_container_format(self, __): def test_image_create_missing_container_format(self, __):
# We test for all possible sources e = self.assertRaises(exc.CommandError, self._run_command,
for origin in ('--file', '--location', '--copy-from'): '--os-image-api-version 2 image-create ' +
e = self.assertRaises(exc.CommandError, self._run_command, '--file fake_src --disk-format qcow2')
'--os-image-api-version 2 image-create ' + self.assertEqual('error: Must provide --container-format when '
origin + ' fake_src --disk-format qcow2') 'using --file.', e.message)
self.assertEqual('error: Must provide --container-format when '
'using ' + origin + '.', e.message)
@mock.patch('sys.stderr') @mock.patch('sys.stderr')
def test_image_create_missing_container_format_stdin_data(self, __): def test_image_create_missing_container_format_stdin_data(self, __):