def test_layout_simple_view_without_template(self): class View(view.View): def render(self): return 'test' view.registerLayout('test') self._init_memphis() v = View(Context(), self.request) layout = queryLayout(self.request, v.context, 'test') layout.update() self.assertTrue('test' == layout.render(v.render()))
def test_layout_simple_context(self): class View(view.View): layout = 'test' def render(self): return 'View: test' class Layout(view.Layout): def render(self, content): return '<html>%s</html>'%content view.registerLayout('test', klass=Layout, context=Context) self._init_memphis() v = View(Context(), self.request) # find layout for view layout = queryLayout(self.request, v.context, 'test') self.assertTrue(isinstance(layout, Layout)) layout.update() self.assertEqual(layout.render(v.render()), '<html>View: test</html>')