Example #1
0
class LoraxTemplateTestCase(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        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):
        """Test LoraxTemplate.parse() with basearch set to x86_64"""
        commands = self.templates.parse("parse-test.tmpl",
                                        {"basearch": "x86_64"})
        self.assertEqual(
            commands,
            [['installpkg', 'common-package'],
             ['installpkg', 'foo-one', 'foo-two'],
             ['installpkg', 'not-s390x-package'], ['run_pkg_transaction']])

    def test_parse_template_s390x(self):
        """Test LoraxTemplate.parse() with basearch set to s390x"""
        commands = self.templates.parse("parse-test.tmpl",
                                        {"basearch": "s390x"})
        self.assertEqual(
            commands,
            [['installpkg', 'common-package'],
             ['installpkg', 'foo-one', 'foo-two'], ['run_pkg_transaction']])
Example #2
0
 def setUpClass(self):
     self.templates = LoraxTemplate(["./tests/pylorax/templates/"])