def test_set_mako(self): app = webapp2.WSGIApplication() self.assertEqual(len(app.registry), 0) mako.set_mako(mako.Mako(app), app=app) self.assertEqual(len(app.registry), 1) j = mako.get_mako(app=app) self.assertTrue(isinstance(j, mako.Mako))
def test_render_template(self): app = webapp2.WSGIApplication(config={ "webapp2_extras.mako": { "template_path": template_path, }, }) req = webapp2.Request.blank("/") app.set_globals(app=app, request=req) m = mako.Mako(app) message = "Hello, World!" res = m.render_template("template1.html", message=message) self.assertEqual(res, message + "\n")
def test_render_template(self): app = webapp2.WSGIApplication(config={ 'webapp2_extras.mako': { 'template_path': template_path, }, }) req = webapp2.Request.blank('/') app.set_globals(app=app, request=req) m = mako.Mako(app) message = 'Hello, World!' res = m.render_template( 'template1.html', message=message) self.assertEqual(res, message + '\n')