def test_create_image(self): image = mock.ANY image_repo = mock.Mock() image_factory = mock.Mock() image_factory.new_image.return_value = image # Note: include some base properties to ensure no error while # attempting to verify them image_properties = {"disk_format": "foo", "id": "bar"} self.assertEqual(image, image_import_script.create_image(image_repo, image_factory, image_properties, None))
def execute(self): task = script_utils.get_task(self.task_repo, self.task_id) if task is None: return task_input = script_utils.unpack_task_input(task) image = image_import.create_image( self.image_repo, self.image_factory, task_input.get('image_properties'), self.task_id) LOG.debug("Task %(task_id)s created image %(image_id)s", {'task_id': task.task_id, 'image_id': image.image_id}) return image.image_id
def test_create_image(self): image = mock.ANY image_repo = mock.Mock() image_factory = mock.Mock() image_factory.new_image.return_value = image # Note: include some base properties to ensure no error while # attempting to verify them image_properties = {'disk_format': 'foo', 'id': 'bar'} self.assertEqual( image, image_import_script.create_image(image_repo, image_factory, image_properties, None))