def setUp(self): """create self.facade, create also a GlanceSyncImage object and a temporal file. Use a mock to replace osclients""" target = dict() target['target_name'] = 'master' target['user'] = '******' target['password'] = '******' target['keystone_url'] = 'http://127.0.0.1/' target['tenant'] = 'faketenant' target['use_keystone_v3'] = False self.target = target self.region = 'fakeregion' targets = dict() targets['master'] = target self.region_obj = GlanceSyncRegion(self.region, targets) mock_osclients.reset_mock() self.facade = ServersFacade(self.target) self.facade.images_dir = None image = GlanceSyncImage('imagetest', '01', self.region, None, False) image.raw = dict() image.raw['disk_format'] = 'qcow2' image.raw['is_public'] = False image.raw['protected'] = False image.raw['container_format'] = 'bare' image.raw['min_ram'] = '0' image.raw['min_disk'] = '0' self.image = image
def create_image(self): """function to create_image, used by several tests; check that UUID is returned""" image = GlanceSyncImage('imagetest', '01', self.region, None, False) image.raw = dict() image.raw['disk_format'] = 'qcow2' image.raw['is_public'] = False image.raw['protected'] = False image.raw['container_format'] = 'bare' image.raw['min_ram'] = '0' image.raw['min_disk'] = '0' image.user_properties['key'] = 'original_value' self.created = self.facade.upload_image(self.region_obj, image) self.assertIsNotNone(self.created)