mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add __init__ and pydsl test
This commit is contained in:
parent
063f075a99
commit
2477ff2eab
2 changed files with 51 additions and 0 deletions
1
tests/integration/renderers/__init__.py
Normal file
1
tests/integration/renderers/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
# -*- coding: utf-8 -*-
|
50
tests/integration/renderers/pydsl_test.py
Normal file
50
tests/integration/renderers/pydsl_test.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
# Import Salt Testing libs
|
||||
from salttesting.helpers import ensure_in_syspath
|
||||
|
||||
ensure_in_syspath('../')
|
||||
|
||||
# Import Salt libs
|
||||
import integration
|
||||
import salt.utils
|
||||
|
||||
|
||||
class PyDSLRendererIncludeTestCase(integration.ModuleCase):
|
||||
|
||||
def test_rendering_includes(self):
|
||||
'''
|
||||
This test is currently hard-coded to /tmp to work-around a seeming
|
||||
inability to load custom modules inside the pydsl renderers. This
|
||||
is a FIXME.
|
||||
'''
|
||||
try:
|
||||
self.run_function('state.sls', ['pydsl.aaa'])
|
||||
|
||||
expected = textwrap.dedent('''\
|
||||
X1
|
||||
X2
|
||||
X3
|
||||
Y1 extended
|
||||
Y2 extended
|
||||
Y3
|
||||
hello red 1
|
||||
hello green 2
|
||||
hello blue 3
|
||||
''')
|
||||
|
||||
with salt.utils.fopen('/tmp/output', 'r') as f:
|
||||
self.assertEqual(sorted(f.read()), sorted(expected))
|
||||
|
||||
finally:
|
||||
os.remove('/tmp/output')
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
tests = [PyDSLRendererIncludeTestCase]
|
||||
run_tests(*tests, needs_daemon=True)
|
Loading…
Add table
Reference in a new issue