def testSourceView(self): page = ZPTPage() utext = u'another test\n' # The source will grow a newline if ommited html = u"<html><body>%s</body></html>\n" % (utext, ) page.setSource(html, content_type='text/plain') request = TestRequest() view = zapi.getMultiAdapter((page, request), name='source.html') self.assertEqual(str(view), html) self.assertEqual(view(), html)
def testView(self): ztapi.browserView(IContent, 'foo', View) ob = Content() v = view(ob, TestRequest()).traverse('foo', ()) self.assertEqual(v.__class__, View)