salt/tests/unit/utils/test_templates.py
Erik Johnson 8cdb9ea54f
[PY3] Add print_function import to files with unicode_literals already added
This makes the 2.x usage invalid syntax and forces the use of print as a
function. This adds the import to the files which I've updated in the
last couple of days but forgot to add it.
2017-12-15 12:14:18 -06:00

26 lines
786 B
Python

# -*- coding: utf-8 -*-
'''
Tests for salt.utils.data
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import textwrap
# Import Salt libs
import salt.utils.templates
from tests.support.unit import TestCase, LOREM_IPSUM
class TemplatesTestCase(TestCase):
def test_get_context(self):
expected_context = textwrap.dedent('''\
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eget urna a arcu lacinia sagittis.
Sed scelerisque, lacus eget malesuada vestibulum, justo diam facilisis tortor, in sodales dolor
[...]
---''')
ret = salt.utils.templates.get_context(LOREM_IPSUM, 1, num_lines=1)
self.assertEqual(ret, expected_context)