pylorax.ltmpl: Add a test for missing quotes

It should raise an error if a quote is missing in the template.
This commit is contained in:
Brian C. Lane 2019-03-21 11:08:22 -07:00
parent 6ccbfe0585
commit df3aeee802
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,4 @@
<%page args="basearch"/>
# missing quote
replace @ROOT@ 'inst.stage2=hd:LABEL=foo isolinux.cfg

View File

@ -58,6 +58,11 @@ class LoraxTemplateTestCase(unittest.TestCase):
def setUpClass(self): def setUpClass(self):
self.templates = LoraxTemplate(["./tests/pylorax/templates/"]) self.templates = LoraxTemplate(["./tests/pylorax/templates/"])
def test_parse_missing_quote(self):
"""Test parsing a template with missing quote"""
with self.assertRaises(Exception):
self.templates.parse("parse-missing-quote.tmpl", {"basearch": "x86_64"})
def test_parse_template_x86_64(self): def test_parse_template_x86_64(self):
"""Test LoraxTemplate.parse() with basearch set to x86_64""" """Test LoraxTemplate.parse() with basearch set to x86_64"""
commands = self.templates.parse("parse-test.tmpl", {"basearch": "x86_64"}) commands = self.templates.parse("parse-test.tmpl", {"basearch": "x86_64"})