salt/tests/integration/modules/pillar.py
Roman Imankulov bb0ed1a3a7 Tests cleanup
Defined "integration.run_tests()" function which can be used to execute
a particular integration test case. Existing bolerplate code in modules
and states tests is replaced with following lines:

    if __name__ == '__main__':
        from integration import run_tests
        run_tests(TestCaseName)

Typical usecase could look like this:

    python integration/modules/pip.py --no-clean -vv
2012-07-20 12:25:08 +06:00

33 lines
867 B
Python

import integration
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__':
from integration import run_tests
run_tests(PillarModuleTest)