コード例 #1
0
 def test_render(self):
     # TODO: Pass any keyword arguments to the Assignment constructor.
     r = self.renderer(context=self.portal,
                       assignment=portletcalendariocamerale.Assignment())
     r = r.__of__(self.folder)
     r.update()
     output = r.render()
コード例 #2
0
    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'] = portletcalendariocamerale.Assignment()
        editview = getMultiAdapter((mapping['foo'], request), name='edit')
        self.failUnless(
            isinstance(editview, portletcalendariocamerale.EditForm))
コード例 #3
0
    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)

        # TODO: Pass any keyword arguments to the Assignment constructor
        assignment = portletcalendariocamerale.Assignment()

        renderer = getMultiAdapter(
            (context, request, view, manager, assignment), IPortletRenderer)
        self.failUnless(
            isinstance(renderer, portletcalendariocamerale.Renderer))
コード例 #4
0
    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)

        # TODO: Pass any default keyword arguments to the Assignment
        # constructor.
        assignment = assignment or portletcalendariocamerale.Assignment()
        return getMultiAdapter((context, request, view, manager, assignment),
                               IPortletRenderer)
コード例 #5
0
 def test_interfaces(self):
     # TODO: Pass any keyword arguments to the Assignment constructor
     portlet = portletcalendariocamerale.Assignment()
     self.failUnless(IPortletAssignment.providedBy(portlet))
     self.failUnless(IPortletDataProvider.providedBy(portlet.data))