2013-06-24 19:06:49 +00:00
|
|
|
try:
|
|
|
|
import integration
|
|
|
|
except ImportError:
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
sys.path.insert(
|
|
|
|
0, os.path.abspath(
|
|
|
|
os.path.join(
|
|
|
|
os.path.dirname(__file__), '../../'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
import integration
|
2012-05-05 14:09:23 +00:00
|
|
|
|
2012-03-29 22:35:49 +00:00
|
|
|
|
|
|
|
class PillarModuleTest(integration.ModuleCase):
|
|
|
|
'''
|
|
|
|
Validate the pillar module
|
|
|
|
'''
|
|
|
|
def test_data(self):
|
|
|
|
'''
|
|
|
|
pillar.data
|
|
|
|
'''
|
2012-04-02 03:59:23 +00:00
|
|
|
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')
|
|
|
|
|
2013-02-06 20:03:34 +00:00
|
|
|
def test_ext_cmd_yaml(self):
|
|
|
|
'''
|
|
|
|
pillar.data for ext_pillar cmd.yaml
|
|
|
|
'''
|
|
|
|
self.assertEqual(
|
|
|
|
self.run_function('pillar.data')['ext_spam'], 'eggs'
|
|
|
|
)
|
|
|
|
|
2012-07-20 06:21:01 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(PillarModuleTest)
|