def setUp(self): super(OpenStackVirtualMachineTest, self).setUp() self.mock_check_network_exists = mock.patch.object( os_virtual_machine.OpenStackVirtualMachine, '_CheckNetworkExists').start() FLAGS.ignore_package_requirements = True spec = self._CreateBenchmarkSpecFromYaml(_CFG_DEFAULT_DEFAULT) self.openstack_vm = os_virtual_machine.OpenStackVirtualMachine(spec)
def test_CheckFloatingIPNetworkExistsWithFail(self, mock_CheckNetworkExists, flags=FLAGS): mock_CheckNetworkExists.return_value = _network_fail flags.ignore_package_requirements = True spec = self._CreateBenchmarkSpecFromYaml(_CFG_DEFAULT_DEFAULT) openstackVM = os_virtual_machine.OpenStackVirtualMachine(spec) with self.assertRaises(errors.Config.InvalidValue): openstackVM._CheckFloatingIPNetworkExists('External')
def test_CheckFloatingIPNetworkExistsWithExternal(self, mock_CheckNetworkExists, flags=FLAGS): mock_CheckNetworkExists.return_value = _network_external flags.ignore_package_requirements = True spec = self._CreateBenchmarkSpecFromYaml(_CFG_DEFAULT_DEFAULT) openstackVM = os_virtual_machine.OpenStackVirtualMachine(spec) network = openstackVM._CheckFloatingIPNetworkExists('External') self.assertEqual(_network_external, network)