test_chocolatey.py 1020 B

123456789101112131415161718192021222324252627282930313233
  1. import pytest
  2. import salt.utils.path
  3. import salt.utils.platform
  4. from tests.support.case import ModuleCase
  5. from tests.support.helpers import destructiveTest
  6. from tests.support.sminion import create_sminion
  7. from tests.support.unit import skipIf
  8. @skipIf(not salt.utils.platform.is_windows(), "Tests for only Windows")
  9. @destructiveTest
  10. @pytest.mark.windows_whitelisted
  11. class ChocolateyModuleTest(ModuleCase):
  12. """
  13. Validate Chocolatey module
  14. """
  15. @classmethod
  16. def setUpClass(cls):
  17. """
  18. Ensure that Chocolatey is installed
  19. """
  20. if salt.utils.path.which("chocolatey.exe") is None:
  21. sminion = create_sminion()
  22. sminion.functions.chocolatey.bootstrap()
  23. def test_list_(self):
  24. ret = self.run_function("chocolatey.list", narrow="adobereader", exact=True)
  25. self.assertTrue("adobereader" in ret)
  26. def test_list_sources(self):
  27. ret = self.run_function("chocolatey.list_sources")
  28. self.assertTrue("chocolatey" in ret.keys())