示例#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)
示例#2
0
    def test_load_template_missing(self):
        name = 'invalid.jinja2'

        with self.assertRaises(exceptions.ResourceNotFound):
            utils.load_template(name)
示例#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)
示例#4
0
    def test_load_template_missing(self):
        name = 'invalid.jinja2'

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

        template = utils.load_template(name)

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

        template = utils.load_template(name)

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

        with testtools.ExpectedException(exceptions.ResourceNotFound):
            utils.load_template(name)
示例#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)
示例#9
0
    def test_load_template_missing(self):
        name = 'invalid.jinja2'

        with testtools.ExpectedException(exceptions.ResourceNotFound):
            utils.load_template(name)
示例#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)