test_grains.py 834 B

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