test_esxdatacenter.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. """
  3. :codeauthor: :email:`Alexandru Bleotu <alexandru.bleotu@morganstanley.com>`
  4. Tests for functions in salt.modules.esxdatacenter
  5. """
  6. # Import Python Libs
  7. from __future__ import absolute_import, print_function, unicode_literals
  8. # Import Salt Libs
  9. import salt.modules.esxdatacenter as esxdatacenter
  10. # Import Salt Testing Libs
  11. from tests.support.mixins import LoaderModuleMockMixin
  12. from tests.support.mock import MagicMock, patch
  13. from tests.support.unit import TestCase
  14. class GetDetailsTestCase(TestCase, LoaderModuleMockMixin):
  15. """Tests for salt.modules.esxdatacenter.get_details"""
  16. def setup_loader_modules(self):
  17. return {
  18. esxdatacenter: {
  19. "__virtual__": MagicMock(return_value="esxdatacenter"),
  20. "__proxy__": {},
  21. }
  22. }
  23. def test_get_details(self):
  24. mock_get_details = MagicMock()
  25. with patch.dict(
  26. esxdatacenter.__proxy__, {"esxdatacenter.get_details": mock_get_details}
  27. ):
  28. esxdatacenter.get_details()
  29. mock_get_details.assert_called_once_with()