mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
bb0ed1a3a7
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
33 lines
867 B
Python
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)
|