Exemple #1
0
    def test_load_template_keep_trailing_newline(self, mock_resource_string):
        mock_resource_string.return_value = 'Hello {{name}}'.encode('utf-8')

        template = utils.load_template('bind9-zone.jinja2')

        self.assertTrue(template.environment.keep_trailing_newline)
Exemple #2
0
    def test_load_template_missing(self):
        name = 'invalid.jinja2'

        with self.assertRaises(exceptions.ResourceNotFound):
            utils.load_template(name)
Exemple #3
0
    def test_load_template(self, mock_resource_string):
        mock_resource_string.return_value = 'Hello {{name}}'.encode('utf-8')

        template = utils.load_template('bind9-zone.jinja2')

        self.assertIsInstance(template, jinja2.Template)
Exemple #4
0
    def test_load_template_missing(self):
        name = 'invalid.jinja2'

        with self.assertRaises(exceptions.ResourceNotFound):
            utils.load_template(name)
Exemple #5
0
    def test_load_template(self):
        name = 'bind9-config.jinja2'

        template = utils.load_template(name)

        self.assertIsInstance(template, Template)
Exemple #6
0
    def test_load_template(self):
        name = 'bind9-config.jinja2'

        template = utils.load_template(name)

        self.assertIsInstance(template, Template)
Exemple #7
0
    def test_load_template_missing(self):
        name = 'invalid.jinja2'

        with testtools.ExpectedException(exceptions.ResourceNotFound):
            utils.load_template(name)
Exemple #8
0
 def test_load_template_keep_trailing_newline(self):
     name = 'bind9-zone.jinja2'
     template = utils.load_template(name)
     self.assertTrue(template.environment.keep_trailing_newline)
Exemple #9
0
    def test_load_template_missing(self):
        name = 'invalid.jinja2'

        with testtools.ExpectedException(exceptions.ResourceNotFound):
            utils.load_template(name)
Exemple #10
0
 def test_load_template_keep_trailing_newline(self):
     name = 'bind9-zone.jinja2'
     template = utils.load_template(name)
     self.assertTrue(template.environment.keep_trailing_newline)