Fix TestImageService's unit tests

The test class had hardcoded DEFAULT_IMAGE_DIR value to /img/
which resulted in unit tests failures when this path existed
because the tests expect a call to makedirs which didn't happen
as the DEFAULT_IMAGE_DIR already existed.
The patch fixes that by using a less generic path.

Change-Id: I47d15747536394006f6b502b3025220a5077e547
This commit is contained in:
Martin Kopec 2022-03-28 15:58:46 +02:00
parent 9586241409
commit 5ffde61b69
1 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class TestImageService(BaseServiceTest):
self.Service.convert = False
self.Service.client = self.FakeServiceClient()
C.DEFAULT_IMAGE_DIR = "/img/"
C.DEFAULT_IMAGE_DIR = "/tempestconf_img/"
self.conf = TempestConf()
self.conf.set("image", "image_path", "my_image.qcow2")
self.conf.set("image", "http_image", "http_image.qcow2")
@ -62,7 +62,7 @@ class TestImageService(BaseServiceTest):
self.assertEqual(self.conf.get('compute', 'image_ref'), 'id_c')
self.assertEqual(self.conf.get('compute', 'image_ref_alt'), 'id_d')
self.assertEqual(self.conf.get('scenario', 'img_file'),
'/img/my_image.qcow2')
C.DEFAULT_IMAGE_DIR + 'my_image.qcow2')
@mock.patch('config_tempest.services.image.ImageService._find_image')
@mock.patch('config_tempest.services.image.ImageService._download_file')