summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-04-09 18:17:43 +0000
committerGerrit Code Review <review@openstack.org>2018-04-09 18:17:43 +0000
commit947ce4d3c9e6c6df9d0f29ac05d3a83208f1d169 (patch)
tree7b1a948e8f9d3baf0ecc175ff52446ab216c0605
parent4211b67e7aa560b97e19945d3bbb07a697628382 (diff)
parent22568b0c131e41d57b9c24631925517c933307bc (diff)
downloadpython-glanceclient-947ce4d3c9e6c6df9d0f29ac05d3a83208f1d169.tar.gz
Merge "Fix intermittent v2 shell unit test failures" into stable/queens
-rw-r--r--glanceclient/tests/unit/v2/test_shell_v2.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/glanceclient/tests/unit/v2/test_shell_v2.py b/glanceclient/tests/unit/v2/test_shell_v2.py
index 826c58b..e07d073 100644
--- a/glanceclient/tests/unit/v2/test_shell_v2.py
+++ b/glanceclient/tests/unit/v2/test_shell_v2.py
@@ -1217,10 +1217,13 @@ class ShellV2Test(testtools.TestCase):
self.assert_exits_with_msg(func=test_shell.do_image_delete,
func_args=args)
+ @mock.patch('sys.stdout', autospec=True)
@mock.patch.object(utils, 'print_err')
- def test_do_image_download_with_forbidden_id(self, mocked_print_err):
+ def test_do_image_download_with_forbidden_id(self, mocked_print_err,
+ mocked_stdout):
args = self._make_args({'id': 'IMG-01', 'file': None,
'progress': False})
+ mocked_stdout.isatty = lambda: False
with mock.patch.object(self.gc.images, 'data') as mocked_data:
mocked_data.side_effect = exc.HTTPForbidden
try:
@@ -1232,10 +1235,12 @@ class ShellV2Test(testtools.TestCase):
self.assertEqual(1, mocked_data.call_count)
self.assertEqual(1, mocked_print_err.call_count)
+ @mock.patch('sys.stdout', autospec=True)
@mock.patch.object(utils, 'print_err')
- def test_do_image_download_with_500(self, mocked_print_err):
+ def test_do_image_download_with_500(self, mocked_print_err, mocked_stdout):
args = self._make_args({'id': 'IMG-01', 'file': None,
'progress': False})
+ mocked_stdout.isatty = lambda: False
with mock.patch.object(self.gc.images, 'data') as mocked_data:
mocked_data.side_effect = exc.HTTPInternalServerError
try: