def test_download_cloud_image(self): vm = setup_vm.Kvm(self.conf) self.assertTrue(vm.download_cloud_image()) # Trying to download again will find the file in the cache self.assertFalse(vm.download_cloud_image()) # Forcing the download even when the file is present self.assertTrue(vm.download_cloud_image(force=True))
def setUp(self): super(TestMetaData, self).setUp() self.conf = setup_vm.VmStack('foo') self.vm = setup_vm.Kvm(self.conf) images_dir = os.path.join(self.test_base_dir, 'images') os.mkdir(images_dir) config_dir = os.path.join(self.test_base_dir, 'config') self.conf.store._load_from_string(''' vm.name=foo vm.images_dir=%s vm.config_dir=%s ''' % ( images_dir, config_dir, ))
def setUp(self): super(TestCreateUserData, self).setUp() self.conf = setup_vm.VmStack('foo') self.vm = setup_vm.Kvm(self.conf)
def setUp(self): super(TestLaunchpadAccess, self).setUp() self.conf = setup_vm.VmStack('foo') self.vm = setup_vm.Kvm(self.conf) self.ci_data = setup_vm.CIUserData(self.conf)
def test_download_cloud_image_with_unknown_cache_fail(self): dl_cache = os.path.join(self.test_base_dir, 'I-dont-exist') self.conf.set('vm.download_cache', dl_cache) vm = setup_vm.Kvm(self.conf) self.assertRaises(setup_vm.ConfigValueError, vm.download_cloud_image)
def test_download_unknown_cloud_image_fail(self): self.conf.set('vm.cloud_image_name', 'I-dont-exist') vm = setup_vm.Kvm(self.conf) self.assertRaises(setup_vm.CommandError, vm.download_cloud_image)