Esempio n. 1
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.create_cluster(self.mock_dc, 'fake_cluster',
                               self.mock_cluster_spec)
     mock_get_managed_object_name.assert_called_once_with(self.mock_dc)
Esempio n. 2
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.create_cluster(self.mock_dc, 'fake_cluster',
                               self.mock_cluster_spec)
     mock_get_managed_object_name.assert_called_once_with(self.mock_dc)
Esempio n. 3
0
 def test_create_cluster_raise_runtime_fault(self):
     exc = vmodl.RuntimeFault()
     exc.msg = 'RuntimeFault msg'
     self.mock_dc.hostFolder.CreateClusterEx = MagicMock(side_effect=exc)
     with self.assertRaises(VMwareRuntimeError) as excinfo:
         vmware.create_cluster(self.mock_dc, 'fake_cluster',
                               self.mock_cluster_spec)
     self.assertEqual(excinfo.exception.strerror, 'RuntimeFault msg')
Esempio n. 4
0
 def test_create_cluster_raise_runtime_fault(self):
     exc = vmodl.RuntimeFault()
     exc.msg = 'RuntimeFault msg'
     self.mock_dc.hostFolder.CreateClusterEx = MagicMock(
         side_effect=exc)
     with self.assertRaises(VMwareRuntimeError) as excinfo:
         vmware.create_cluster(self.mock_dc, 'fake_cluster',
                               self.mock_cluster_spec)
     self.assertEqual(excinfo.exception.strerror, 'RuntimeFault msg')
Esempio n. 5
0
 def test_create_cluster_raise_no_permission(self):
     exc = vim.fault.NoPermission()
     exc.privilegeId = 'Fake privilege'
     self.mock_dc.hostFolder.CreateClusterEx = MagicMock(side_effect=exc)
     with self.assertRaises(VMwareApiError) as excinfo:
         vmware.create_cluster(self.mock_dc, 'fake_cluster',
                               self.mock_cluster_spec)
     self.assertEqual(
         excinfo.exception.strerror,
         'Not enough permissions. Required privilege: '
         'Fake privilege')
Esempio n. 6
0
 def test_create_cluster_call(self):
     vmware.create_cluster(self.mock_dc, 'fake_cluster',
                           self.mock_cluster_spec)
     self.mock_create_cluster_ex.assert_called_once_with(
         'fake_cluster', self.mock_cluster_spec)
Esempio n. 7
0
 def test_create_cluster_call(self):
     vmware.create_cluster(self.mock_dc, 'fake_cluster',
                           self.mock_cluster_spec)
     self.mock_create_cluster_ex.assert_called_once_with(
        'fake_cluster', self.mock_cluster_spec)