mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
# Import python libs
|
|
import sys
|
|
|
|
# Import salt libs
|
|
from saltunittest import TestLoader, TextTestRunner
|
|
import integration
|
|
from integration import TestDaemon
|
|
|
|
|
|
class PillarModuleTest(integration.ModuleCase):
|
|
'''
|
|
Validate the pillar module
|
|
'''
|
|
def test_data(self):
|
|
'''
|
|
pillar.data
|
|
'''
|
|
grains = self.run_function('grains.items')
|
|
pillar = self.run_function('pillar.data')
|
|
self.assertEqual(pillar['os'], grains['os'])
|
|
self.assertEqual(pillar['monty'], 'python')
|
|
if grains['os'] == 'Fedora':
|
|
self.assertEqual(pillar['class'], 'redhat')
|
|
else:
|
|
self.assertEqual(pillar['class'], 'other')
|
|
|
|
def test_ext_cmd_yaml(self):
|
|
'''
|
|
pillar.data for ext_pillar cmd.yaml
|
|
'''
|
|
self.assertEqual(
|
|
self.run_function('pillar.data')['ext_spam'], 'eggs'
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
loader = TestLoader()
|
|
tests = loader.loadTestsFromTestCase(PillarModuleTest)
|
|
print('Setting up Salt daemons to execute tests')
|
|
with TestDaemon():
|
|
runner = TextTestRunner(verbosity=1).run(tests)
|
|
sys.exit(runner.wasSuccessful())
|