test_grains.py 924 B

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. # Import Python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. import pytest
  5. # Import Salt Libs
  6. import salt.utils.platform
  7. # Import Salt Testing Libs
  8. from tests.support.case import SSHCase
  9. from tests.support.unit import skipIf
  10. @skipIf(salt.utils.platform.is_windows(), "salt-ssh not available on Windows")
  11. class SSHGrainsTest(SSHCase):
  12. """
  13. testing grains with salt-ssh
  14. """
  15. @pytest.mark.slow_test(seconds=30) # Test takes >10 and <=30 seconds
  16. def test_grains_items(self):
  17. """
  18. test grains.items with salt-ssh
  19. """
  20. ret = self.run_function("grains.items")
  21. grain = "Linux"
  22. if salt.utils.platform.is_darwin():
  23. grain = "Darwin"
  24. if salt.utils.platform.is_aix():
  25. grain = "AIX"
  26. self.assertEqual(ret["kernel"], grain)
  27. self.assertTrue(isinstance(ret, dict))