summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-07-21 14:41:24 -0400
committerScott Moser <smoser@ubuntu.com>2014-07-21 14:41:24 -0400
commit96e9e1b0509a9a000303ad72b2a332dc8821191e (patch)
treebd71fd4dd7192c3940bf63251b984ee50b9a772d /tests
parent0dbd2a0ec71de2f9d8d631ae5241a948fc6a51ee (diff)
downloadvyos-cloud-init-96e9e1b0509a9a000303ad72b2a332dc8821191e.tar.gz
vyos-cloud-init-96e9e1b0509a9a000303ad72b2a332dc8821191e.zip
use textwrap, simple formatting improvement.
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_templating.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/unittests/test_templating.py b/tests/unittests/test_templating.py
index 5601a2e1..1ec3004b 100644
--- a/tests/unittests/test_templating.py
+++ b/tests/unittests/test_templating.py
@@ -17,23 +17,24 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from tests.unittests import helpers as test_helpers
+import textwrap
from cloudinit import templater
class TestTemplates(test_helpers.TestCase):
def test_render_basic(self):
- in_data = """
-${b}
+ in_data = textwrap.dedent("""
+ ${b}
-c = d
-"""
+ c = d
+ """)
in_data = in_data.strip()
- expected_data = """
-2
+ expected_data = textwrap.dedent("""
+ 2
-c = d
-"""
+ c = d
+ """)
out_data = templater.basic_render(in_data, {'b': 2})
self.assertEqual(expected_data.strip(), out_data)
@@ -102,5 +103,5 @@ $a,$b'''
ex_data = "deb %s %s-updates main contrib non-free" % (mirror, codename)
out_data = templater.basic_render(in_data,
- {'mirror': mirror, 'codename': codename})
+ {'mirror': mirror, 'codename': codename})
self.assertEqual(ex_data, out_data)