"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/integration/renderers/test_pydsl.py" between
salt-2019.2.0.tar.gz and salt-2019.2.1.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

test_pydsl.py  (salt-2019.2.0):test_pydsl.py  (salt-2019.2.1)
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Import Python libs # Import Python libs
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
import os import os
import shutil
import textwrap import textwrap
# Import Salt Testing libs # Import Salt Testing libs
from tests.support.case import ModuleCase from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
# Import Salt libs # Import Salt libs
import salt.utils.files import salt.utils.files
import salt.utils.platform import salt.utils.platform
import salt.utils.stringutils import salt.utils.stringutils
class PyDSLRendererIncludeTestCase(ModuleCase): class PyDSLRendererIncludeTestCase(ModuleCase):
def setUp(self):
self.directory_created = False
if salt.utils.platform.is_windows():
if not os.path.isdir('\\tmp'):
os.mkdir('\\tmp')
self.directory_created = True
def tearDown(self):
if salt.utils.platform.is_windows():
if self.directory_created:
shutil.rmtree('\\tmp')
@destructiveTest
def test_rendering_includes(self): def test_rendering_includes(self):
''' '''
This test is currently hard-coded to /tmp to work-around a seeming This test is currently hard-coded to /tmp to work-around a seeming
inability to load custom modules inside the pydsl renderers. This inability to load custom modules inside the pydsl renderers. This
is a FIXME. is a FIXME.
''' '''
self.run_function('state.sls', ['pydsl.aaa']) self.run_function('state.sls', ['pydsl.aaa'])
expected = textwrap.dedent('''\ expected = textwrap.dedent('''\
X1 X1
skipping to change at line 51 skipping to change at line 66
expected = 'X1 \r\n' \ expected = 'X1 \r\n' \
'X2 \r\n' \ 'X2 \r\n' \
'X3 \r\n' \ 'X3 \r\n' \
'Y1 extended \r\n' \ 'Y1 extended \r\n' \
'Y2 extended \r\n' \ 'Y2 extended \r\n' \
'Y3 \r\n' \ 'Y3 \r\n' \
'hello red 1 \r\n' \ 'hello red 1 \r\n' \
'hello green 2 \r\n' \ 'hello green 2 \r\n' \
'hello blue 3 \r\n' 'hello blue 3 \r\n'
with salt.utils.files.fopen('/tmp/output', 'r') as f: try:
ret = salt.utils.stringutils.to_unicode(f.read()) with salt.utils.files.fopen('/tmp/output', 'r') as f:
ret = salt.utils.stringutils.to_unicode(f.read())
os.remove('/tmp/output') finally:
os.remove('/tmp/output')
self.assertEqual(sorted(ret), sorted(expected)) self.assertEqual(sorted(ret), sorted(expected))
 End of changes. 4 change blocks. 
4 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)