예제 #1
0
 def test_create_cluster_raise_vim_fault(self):
     exc = vim.fault.VimFault()
     exc.msg = 'VimFault msg'
     self.mock_cluster.ReconfigureComputeResource_Task = \
             MagicMock(side_effect=exc)
     with self.assertRaises(VMwareApiError) as excinfo:
         vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     self.assertEqual(excinfo.exception.strerror, 'VimFault msg')
예제 #2
0
 def test_reconfigure_compute_resource_raise_runtime_fault(self):
     exc = vmodl.RuntimeFault()
     exc.msg = 'RuntimeFault msg'
     self.mock_cluster.ReconfigureComputeResource_Task = \
             MagicMock(side_effect=exc)
     with self.assertRaises(VMwareRuntimeError) as excinfo:
         vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     self.assertEqual(excinfo.exception.strerror, 'RuntimeFault msg')
예제 #3
0
파일: cluster_test.py 프로젝트: bryson/salt
 def test_reconfigure_compute_resource_raise_runtime_fault(self):
     exc = vmodl.RuntimeFault()
     exc.msg = 'RuntimeFault msg'
     self.mock_cluster.ReconfigureComputeResource_Task = \
             MagicMock(side_effect=exc)
     with self.assertRaises(VMwareRuntimeError) as excinfo:
         vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     self.assertEqual(excinfo.exception.strerror, 'RuntimeFault msg')
예제 #4
0
파일: cluster_test.py 프로젝트: bryson/salt
 def test_wait_for_task_call(self):
     mock_wait_for_task = MagicMock()
     with patch('salt.utils.vmware.get_managed_object_name',
                MagicMock(return_value='fake_cluster')):
         with patch('salt.utils.vmware.wait_for_task', mock_wait_for_task):
             vmware.update_cluster(self.mock_cluster,
                                   self.mock_cluster_spec)
     mock_wait_for_task.assert_called_once_with(
         self.mock_task, 'fake_cluster', 'ClusterUpdateTask')
예제 #5
0
 def test_wait_for_task_call(self):
     mock_wait_for_task = MagicMock()
     with patch('salt.utils.vmware.get_managed_object_name',
                MagicMock(return_value='fake_cluster')):
         with patch('salt.utils.vmware.wait_for_task', mock_wait_for_task):
             vmware.update_cluster(self.mock_cluster,
                                   self.mock_cluster_spec)
     mock_wait_for_task.assert_called_once_with(self.mock_task,
                                                'fake_cluster',
                                                'ClusterUpdateTask')
예제 #6
0
 def test_reconfigure_compute_resource_raise_no_permission(self):
     exc = vim.fault.NoPermission()
     exc.privilegeId = 'Fake privilege'
     self.mock_cluster.ReconfigureComputeResource_Task = \
             MagicMock(side_effect=exc)
     with self.assertRaises(VMwareApiError) as excinfo:
         vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     self.assertEqual(
         excinfo.exception.strerror,
         'Not enough permissions. Required privilege: '
         'Fake privilege')
예제 #7
0
 def test_reconfigure_compute_resource_task_call(self):
     vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     self.mock_reconfigure_compute_resource_task.assert_called_once_with(
         self.mock_cluster_spec, modify=True)
예제 #8
0
 def test_get_managed_object_name(self):
     mock_get_managed_object_name = MagicMock()
     with patch('salt.utils.vmware.get_managed_object_name',
                mock_get_managed_object_name):
         vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     mock_get_managed_object_name.assert_called_once_with(self.mock_cluster)
예제 #9
0
파일: cluster_test.py 프로젝트: bryson/salt
 def test_reconfigure_compute_resource_task_call(self):
     vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     self.mock_reconfigure_compute_resource_task.assert_called_once_with(
         self.mock_cluster_spec, modify=True)
예제 #10
0
파일: cluster_test.py 프로젝트: bryson/salt
 def test_get_managed_object_name(self):
     mock_get_managed_object_name = MagicMock()
     with patch('salt.utils.vmware.get_managed_object_name',
                mock_get_managed_object_name):
         vmware.update_cluster(self.mock_cluster, self.mock_cluster_spec)
     mock_get_managed_object_name.assert_called_once_with(self.mock_cluster)