Ejemplo n.º 1
0
    def testInvokeEditView(self):
        mapping = PortletAssignmentMapping()
        request = self.folder.REQUEST

        mapping['foo'] = person.Assignment(header=u"title", text="text")
        editview = getMultiAdapter((mapping['foo'], request), name='edit')
        self.failUnless(isinstance(editview, person.EditForm))
Ejemplo n.º 2
0
 def test_no_header(self):
     r = self.renderer(context=self.portal,
                       assignment=person.Assignment(text="<b>text</b>"))
     r = r.__of__(self.folder)
     r.update()
     output = r.render()
     self.assertTrue('<a class="tile"' not in output)
     self.assertTrue('<header class="portletHeader titleless"' in output)
Ejemplo n.º 3
0
 def test_render(self):
     r = self.renderer(context=self.portal,
                       assignment=person.Assignment(header=u"title",
                                                    text="<b>text</b>"))
     r = r.__of__(self.folder)
     r.update()
     output = r.render()
     self.failUnless('title' in output)
     self.failUnless('<b>text</b>' in output)
Ejemplo n.º 4
0
 def test_relative_link(self):
     folder_id = self.portal.invokeFactory('Folder',
                                           id='folder1',
                                           title='My Folder Title')
     r = self.renderer(context=self.portal[folder_id],
                       assignment=person.Assignment(
                           text="""<a href="relative/link">link</a>"""))
     r = r.__of__(self.folder)
     r.update()
     output = r.render()
     self.assertTrue("http://nohost/plone/relative/link" in output)
Ejemplo n.º 5
0
    def testRenderer(self):
        context = self.folder
        request = self.folder.REQUEST
        view = self.folder.restrictedTraverse('@@plone')
        manager = getUtility(IPortletManager,
                             name='plone.rightcolumn',
                             context=self.portal)
        assignment = person.Assignment(header=u"title", text="text")

        renderer = getMultiAdapter(
            (context, request, view, manager, assignment), IPortletRenderer)
        self.failUnless(isinstance(renderer, person.Renderer))

        self.failUnless(renderer.available,
                        "Renderer should be available by default.")
Ejemplo n.º 6
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)
     assignment = assignment or person.Assignment(header=u"title",
                                                  text="text")
     ren = getMultiAdapter((context, request, view, manager, assignment),
                           IPortletRenderer)
     ren.__portlet_metadata__ = {
         'key': '/'.join(self.portal.getPhysicalPath())
     }
     return ren
Ejemplo n.º 7
0
 def testInterfaces(self):
     portlet = person.Assignment(header=u"title", text="text")
     self.failUnless(IPortletAssignment.providedBy(portlet))
     self.failUnless(IPortletDataProvider.providedBy(portlet.data))
Ejemplo n.º 8
0
 def test_css_class(self):
     r = self.renderer(context=self.portal,
                       assignment=person.Assignment(header=u"Welcome text",
                                                    text="<b>text</b>"))
     self.assertEquals('portlet-person-welcome-text', r.css_class())