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)
def test_load_template_missing(self): name = 'invalid.jinja2' with self.assertRaises(exceptions.ResourceNotFound): utils.load_template(name)
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)
def test_load_template(self): name = 'bind9-config.jinja2' template = utils.load_template(name) self.assertIsInstance(template, Template)
def test_load_template_missing(self): name = 'invalid.jinja2' with testtools.ExpectedException(exceptions.ResourceNotFound): utils.load_template(name)
def test_load_template_keep_trailing_newline(self): name = 'bind9-zone.jinja2' template = utils.load_template(name) self.assertTrue(template.environment.keep_trailing_newline)