def test_render(self):
     r = self.renderer(
         context=self.portal,
         assignment=collectionbysubject.Assignment(header='test header'))
     r = r.__of__(self.folder)
     r.update()
     output = r.render()
    def test_invoke_edit_view(self):
        # NOTE: This test can be removed if the portlet has no edit form
        mapping = PortletAssignmentMapping()
        request = self.folder.REQUEST

        mapping['foo'] = collectionbysubject.Assignment()
        editview = getMultiAdapter((mapping['foo'], request), name='edit')
        self.failUnless(isinstance(editview, collectionbysubject.EditForm))
    def test_obtain_renderer(self):
        context = self.folder
        request = self.folder.REQUEST
        view = self.folder.restrictedTraverse('@@plone')
        manager = getUtility(IPortletManager,
                             name='plone.rightcolumn',
                             context=self.portal)

        assignment = collectionbysubject.Assignment(header='test header')

        renderer = getMultiAdapter(
            (context, request, view, manager, assignment), IPortletRenderer)
        self.failUnless(isinstance(renderer, collectionbysubject.Renderer))
    def renderer(self,
                 context=None,
                 request=None,
                 view=None,
                 manager=None,
                 assignment=None):
        context = context or self.folder
        request = request or self.folder.REQUEST
        view = view or self.folder.restrictedTraverse('@@plone')
        manager = manager or getUtility(
            IPortletManager, name='plone.rightcolumn', context=self.portal)

        assignment = assignment or collectionbysubject.Assignment(
            header='test header')
        return getMultiAdapter((context, request, view, manager, assignment),
                               IPortletRenderer)
 def test_interfaces(self):
     portlet = collectionbysubject.Assignment(header='test header')
     self.failUnless(IPortletAssignment.providedBy(portlet))
     self.failUnless(IPortletDataProvider.providedBy(portlet.data))