def test_deploy_image_execute(self): deployer = Mock() si = Mock() deployment_params = Mock() connectivity = Mock() res = Mock() deployer.deploy_from_image = Mock(return_value=res) session = Mock() vcenter_data_model = Mock() deploy_command = DeployCommand(deployer) # act result = deploy_command.execute_deploy_from_image( si=si, logger=Mock(), session=session, vcenter_data_model=vcenter_data_model, deployment_params=deployment_params, resource_context=connectivity) # assert self.assertTrue(result) self.assertTrue( deployer.deploy_from_image.called_with(si, deployment_params, connectivity))
def test_deploy_image(self): # arrange cred = TestCredentials() pv_service = pyVmomiService(SmartConnect, Disconnect) si = pv_service.connect(cred.host, cred.username, cred.password) service = OvfImageDeployerService( 'C:\\Program Files\\VMware\\VMware OVF Tool\\ovftool.exe', Mock()) deployer = VirtualMachineDeployer(pv_service, generate_unique_name, service) # vm = pv_service.find_vm_by_name(si, 'QualiSB/Raz', '2') params = DeployDataHolder({ "image_url": "http://192.168.65.88/ovf/Debian%2064%20-%20Yoav.ovf", "cluster_name": "QualiSB Cluster", "resource_pool": "LiverPool", "datastore_name": "datastore1", "datacenter_name": "QualiSB", "power_on": True, "app_name": "appName 1", "vm_folder": "Raz 2" }) deploy_command = DeployCommand(deployer) # act result = deploy_command.execute_deploy_from_image(si, params, cred) # assert self.assertIsNotNone(result)
def test_deploy_image(self): # arrange cred = TestCredentials() pv_service = pyVmomiService(SmartConnect, Disconnect) si = pv_service.connect(cred.host, cred.username, cred.password) service = OvfImageDeployerService('C:\\Program Files\\VMware\\VMware OVF Tool\\ovftool.exe', Mock()) deployer = VirtualMachineDeployer(pv_service, generate_unique_name, service) # vm = pv_service.find_vm_by_name(si, 'QualiSB/Raz', '2') params = DeployDataHolder( { "image_url": "http://192.168.65.88/ovf/Debian%2064%20-%20Yoav.ovf", "cluster_name": "QualiSB Cluster", "resource_pool": "LiverPool", "datastore_name": "datastore1", "datacenter_name": "QualiSB", "power_on": True, "app_name": "appName 1", "vm_folder": "Raz 2" }) deploy_command = DeployCommand(deployer) # act result = deploy_command.execute_deploy_from_image(si, params, cred) # assert self.assertIsNotNone(result)
def test_deploy_image_execute(self): deployer = Mock() si = Mock() deployment_params = Mock() deployment_params.template_resource_model.vm_location = 'SomeFolder' connectivity = Mock() res = Mock() deployer.deploy_from_image = Mock(return_value=res) session = Mock() vcenter_data_model = Mock() vcenter_data_model.default_datacenter = 'QualiSB' logger = Mock() reservation_id = Mock() deploy_command = DeployCommand(deployer) cancellation_context = object() # act folder_manager = Mock() result = deploy_command.execute_deploy_from_image( si=si, logger=logger, session=session, vcenter_data_model=vcenter_data_model, deployment_params=deployment_params, resource_context=connectivity, reservation_id=reservation_id, cancellation_context=cancellation_context, folder_manager=folder_manager) # assert self.assertTrue(result) deployer.deploy_from_image.assert_called_once_with( si=si, logger=logger, session=session, vcenter_data_model=vcenter_data_model, data_holder=deployment_params, resource_context=connectivity, reservation_id=reservation_id, cancellation_context=cancellation_context)
def test_deploy_image_execute(self): deployer = Mock() si = Mock() deployment_params = Mock() connectivity = Mock() res = Mock() deployer.deploy_from_image = Mock(return_value=res) session = Mock() vcenter_data_model = Mock() deploy_command = DeployCommand(deployer) # act result = deploy_command.execute_deploy_from_image(si=si, logger=Mock(), session=session, vcenter_data_model=vcenter_data_model, deployment_params=deployment_params, resource_context=connectivity) # assert self.assertTrue(result) self.assertTrue(deployer.deploy_from_image.called_with(si, deployment_params, connectivity))