From d741556f0f0a012ec82d08ae30eacd7d07b8a439 Mon Sep 17 00:00:00 2001 From: Bob Fournier Date: Thu, 26 Apr 2018 20:25:51 -0400 Subject: [PATCH] Add unit test for check of glance image status Add a unit test for glance image status check added in https://review.openstack.org/#/c/559500/. Change-Id: I3be46cf4fe46a981caa6711a962324a6a1a67cfa --- ironic/tests/unit/common/test_glance_service.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ironic/tests/unit/common/test_glance_service.py b/ironic/tests/unit/common/test_glance_service.py index 14ff155b7e..f2afe72ea0 100644 --- a/ironic/tests/unit/common/test_glance_service.py +++ b/ironic/tests/unit/common/test_glance_service.py @@ -171,6 +171,15 @@ class TestGlanceImageService(base.TestCase): self.service.show, uuidutils.generate_uuid()) + def test_show_raises_when_image_not_active(self): + image_id = uuidutils.generate_uuid() + image = self._make_fixture(name='image1', is_public=True, + id=image_id, status="queued") + with mock.patch.object(self.service, 'call', return_value=image, + autospec=True): + self.assertRaises(exception.ImageUnacceptable, + self.service.show, image_id) + @mock.patch.object(time, 'sleep', autospec=True) def test_download_with_retries(self, mock_sleep): tries = [0]