test_chocolatey.py 940 B

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