def test_grok_content_provider(self): signature = "zope.viewlet.interfaces.IViewletManager:footer:None:" \ "silva.core.interfaces.content.IViewableObject:" \ "silva.core.layout.porto.interfaces.IPorto:" \ "zope.browser.interfaces.IBrowserView" manager = IViewManager(self.utility) view = manager.from_signature(signature) self.assertFalse(view is None) self.assertTrue(verifyObject(IViewInfo, view)) self.assertEqual(view.type_, 'Grok Content Provider') self.assertEqual(view.name, 'footer') self.assertEqual( view.for_, 'silva.core.interfaces.content.IViewableObject') self.assertEqual( view.layer, 'silva.core.layout.porto.interfaces.IPorto') self.assertEqual(basename(view.template), 'footer.cpt') self.assertEqual(view.origin, None) self.assertEqual(manager.get_signature(view), signature)
def test_grok_template(self): signature = "zope.interface.Interface:index.html:None:" \ "silva.core.interfaces.content.IViewableObject:" \ "silva.core.layout.interfaces.ISilvaLayer" manager = IViewManager(self.utility) view = manager.from_signature(signature) self.assertFalse(view is None) self.assertTrue(verifyObject(IViewInfo, view)) self.assertEqual(view.type_, 'Grok Page Template') self.assertEqual(view.name, 'index.html') self.assertEqual( view.for_, 'silva.core.interfaces.content.IViewableObject') self.assertEqual( view.layer, 'silva.core.layout.interfaces.ISilvaLayer') self.assertEqual(view.template, None) self.assertEqual(view.origin, None) self.assertEqual(manager.get_signature(view), signature)