Esempio n. 1
0
 def test_get_mors_with_properties(self):
     vmware.get_network_folder(self.mock_dc_ref)
     self.mock_get_mors.assert_called_once_with(
         self.mock_si,
         vim.Folder,
         container_ref=self.mock_dc_ref,
         property_list=['name'],
         traversal_spec=self.mock_traversal_spec)
Esempio n. 2
0
 def test_get_no_network_folder(self):
     with patch('salt.utils.vmware.get_mors_with_properties',
                MagicMock(return_value=[])):
         with self.assertRaises(VMwareObjectRetrievalError) as excinfo:
             vmware.get_network_folder(self.mock_dc_ref)
     self.assertEqual(
         excinfo.exception.strerror,
         'Network folder in datacenter \'fake_dc\' wasn\'t '
         'retrieved')
Esempio n. 3
0
    def test_traversal_spec(self):
        mock_traversal_spec = MagicMock(return_value='traversal_spec')
        with patch(
                'salt.utils.vmware.vmodl.query.PropertyCollector.TraversalSpec',
                mock_traversal_spec):

            vmware.get_network_folder(self.mock_dc_ref)
        mock_traversal_spec.assert_called_once_with(path='networkFolder',
                                                    skip=False,
                                                    type=vim.Datacenter)
Esempio n. 4
0
 def test_get_network_folder(self):
     ret = vmware.get_network_folder(self.mock_dc_ref)
     self.assertEqual(ret, self.mock_entries[0]['object'])
Esempio n. 5
0
 def test_get_managed_object_name_call(self):
     mock_get_managed_object_name = MagicMock()
     with patch('salt.utils.vmware.get_managed_object_name',
                mock_get_managed_object_name):
         vmware.get_network_folder(self.mock_dc_ref)
     mock_get_managed_object_name.assert_called_once_with(self.mock_dc_ref)