Back to index

plone3  3.1.7
Public Member Functions
plone.portlet.static.tests.test_portlet_static.TestPortlet Class Reference
Inheritance diagram for plone.portlet.static.tests.test_portlet_static.TestPortlet:
Inheritance graph
[legend]
Collaboration diagram for plone.portlet.static.tests.test_portlet_static.TestPortlet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testPortletTypeRegistered
def testInterfaces
def testInvokeAddview
def testInvokeEditView
def testRenderer

Detailed Description

Definition at line 15 of file test_portlet_static.py.


Member Function Documentation

Definition at line 17 of file test_portlet_static.py.

00017 
00018     def afterSetUp(self):
00019         self.setRoles(('Manager',))

Here is the call graph for this function:

Definition at line 24 of file test_portlet_static.py.

00024 
00025     def testInterfaces(self):
00026         portlet = static.Assignment(header=u"title", text="text")
00027         self.failUnless(IPortletAssignment.providedBy(portlet))
00028         self.failUnless(IPortletDataProvider.providedBy(portlet.data))

Definition at line 29 of file test_portlet_static.py.

00029 
00030     def testInvokeAddview(self):
00031         portlet = getUtility(IPortletType, name='plone.portlet.static.Static')
00032         mapping = self.portal.restrictedTraverse('++contextportlets++plone.leftcolumn')
00033         for m in mapping.keys():
00034             del mapping[m]
00035         addview = mapping.restrictedTraverse('+/' + portlet.addview)
00036 
00037         addview.createAndAdd(data={'header' : u"test title", 'text' : u"test text"})
00038 
00039         self.assertEquals(len(mapping), 1)
00040         self.failUnless(isinstance(mapping.values()[0], static.Assignment))

Definition at line 41 of file test_portlet_static.py.

00041 
00042     def testInvokeEditView(self):
00043         mapping = PortletAssignmentMapping()
00044         request = self.folder.REQUEST
00045 
00046         mapping['foo'] = static.Assignment(header=u"title", text="text")
00047         editview = getMultiAdapter((mapping['foo'], request), name='edit')
00048         self.failUnless(isinstance(editview, static.EditForm))

Definition at line 20 of file test_portlet_static.py.

00020 
00021     def testPortletTypeRegistered(self):
00022         portlet = getUtility(IPortletType, name='plone.portlet.static.Static')
00023         self.assertEquals(portlet.addview, 'plone.portlet.static.Static')

Definition at line 49 of file test_portlet_static.py.

00049 
00050     def testRenderer(self):
00051         context = self.folder
00052         request = self.folder.REQUEST
00053         view = self.folder.restrictedTraverse('@@plone')
00054         manager = getUtility(IPortletManager, name='plone.rightcolumn', context=self.portal)
00055         assignment = static.Assignment(header=u"title", text="text")
00056 
00057         renderer = getMultiAdapter((context, request, view, manager, assignment), IPortletRenderer)
00058         self.failUnless(isinstance(renderer, static.Renderer))
00059 
00060         self.failUnless(renderer.available,
00061                         "Renderer should be available by default.")
00062         assignment = static.Assignment(header=u"title", text="text", hide=True)
00063         renderer = getMultiAdapter((context, request, view, manager, assignment), IPortletRenderer)
00064         self.failIf(renderer.available, "Renderer should not be available.")
00065 

Here is the call graph for this function:


The documentation for this class was generated from the following file: