Exemplo n.º 1
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'] = calltoactionportlet.Assignment()
        editview = getMultiAdapter((mapping['foo'], request), name='edit')
        self.failUnless(isinstance(editview, calltoactionportlet.EditForm))
Exemplo n.º 2
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 = calltoactionportlet.Assignment()

        renderer = getMultiAdapter(
            (context, request, view, manager, assignment), IPortletRenderer)
        self.failUnless(isinstance(renderer, calltoactionportlet.Renderer))
Exemplo n.º 3
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 calltoactionportlet.Assignment()
        return getMultiAdapter((context, request, view, manager, assignment),
                               IPortletRenderer)
Exemplo n.º 4
0
 def test_render(self):
     r = self.renderer(
         context=self.portal,
         assignment=calltoactionportlet.Assignment(
             header='My overlay header',
             text='My overlay text',
             milli_seconds_until_overlay=1000,
         ))
     r = r.__of__(self.folder)
     r.update()
     # The portlet is not available, because we do not want to render it in
     # a portlet column.
     self.assertFalse(r.available)
     # But the viewlet renders it.
     output = r.render()
     # css class
     self.assertIn('portletCallToAction', output)
     # fields
     self.assertIn('My overlay header', output)
     self.assertIn('My overlay text', output)
Exemplo n.º 5
0
 def test_interfaces(self):
     # TODO: Pass any keyword arguments to the Assignment constructor
     portlet = calltoactionportlet.Assignment()
     self.failUnless(IPortletAssignment.providedBy(portlet))
     self.failUnless(IPortletDataProvider.providedBy(portlet.data))