Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
plone.app.kss.tests.test_part_reloading.TestPortletReloading Class Reference
Inheritance diagram for plone.app.kss.tests.test_part_reloading.TestPortletReloading:
Inheritance graph
[legend]
Collaboration diagram for plone.app.kss.tests.test_part_reloading.TestPortletReloading:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_no_update_of_nav_portlet_when_unhooked
def test_no_update_of_nav_portlet_when_hooked_with_wrong_event
def test_update_of_nav_portlet
def create_portlet
def test_update_of_recent_portlet
def loadCoreConfig
def createView
def setDebugRequest

Public Attributes

 view

Static Public Attributes

 layer = KSSAndPloneLayer

Detailed Description

Definition at line 28 of file test_part_reloading.py.


Member Function Documentation

Definition at line 30 of file test_part_reloading.py.

00030 
00031     def afterSetUp(self):
00032         KSSAndPloneTestCase.afterSetUp(self)
00033         self.setDebugRequest()
00034         self.loginAsPortalOwner()
00035         self.setRoles(['Manager',])
00036         # register the sample view
00037         self.view = self.portal.restrictedTraverse('@@change_title')

Here is the call graph for this function:

Definition at line 72 of file test_part_reloading.py.

00072 
00073     def create_portlet(self, name, portlet):
00074         leftColumn = getUtility(IPortletManager, name=u'plone.leftcolumn',
00075                             context=self.portal)
00076         left = getMultiAdapter((self.portal, leftColumn,), IPortletAssignmentMapping,
00077                             context=self.portal)
00078         assert name not in left, 'Portlet is already there, no need to create it - fix me'
00079         left[name] = portlet

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 108 of file base.py.

00108 
00109     def createView(self):
00110         "Set up a fake view (with no content)"
00111         self.view = self.folder.restrictedTraverse('testMethod')
00112         return self.view

Here is the caller graph for this function:

def kss.core.tests.base.KSSViewTestCaseMixin.loadCoreConfig (   self,
  kss_core = True 
) [inherited]

Definition at line 102 of file base.py.

00102 
00103     def loadCoreConfig(self, kss_core=True):
00104         warnings.warn(
00105             "KSS tests are now using layers.  Please do not use "
00106             "loadCoreConfig anymore.",
00107             DeprecationWarning)
    

Definition at line 113 of file base.py.

00113 
00114     def setDebugRequest(self):
00115         'commands will be rendered as test friendly data structures'
00116         request = self.folder.REQUEST
00117         interface.directlyProvides(
00118             request,
00119             interface.directlyProvidedBy(request) + IDebugRequest)

Here is the caller graph for this function:

Definition at line 43 of file test_part_reloading.py.

00043 
00044     def test_no_update_of_nav_portlet_when_hooked_with_wrong_event(self):
00045         # nothing should happen still because we must change the title or the
00046         # description
00047         modified_event = ObjectEditedEvent(self.folder)
00048         attributesTriggerNavigationPortletReload(self.folder, self.view, modified_event)
00049         result = self.view.render()
00050         self.assertEqual(result, [])

Here is the call graph for this function:

Definition at line 38 of file test_part_reloading.py.

00038 
00039     def test_no_update_of_nav_portlet_when_unhooked(self):
00040         # nothing should happen
00041         result = self.view.render()
00042         self.assertEqual(result, [])

Definition at line 51 of file test_part_reloading.py.

00051 
00052     def test_update_of_nav_portlet(self):
00053         # create the view on the user folder instead of the portal root,
00054         # because there is no more a nav portlet on the portal root.
00055         self.view = self.folder.restrictedTraverse('@@change_title')
00056         descriptor = lifecycleevent.Attributes(IPortalObject, 'title')
00057         modified_event = ObjectEditedEvent(self.folder, descriptor)
00058         attributesTriggerNavigationPortletReload(self.folder, self.view, modified_event)
00059         result = self.view.render()
00060         command = result[0]
00061         self.failUnless(command.has_key('selector'))
00062         self.failUnless(command['selector'].startswith('portletwrapper'))
00063         self.failUnless(command.has_key('name'))
00064         self.assertEqual(command['name'], 'replaceInnerHTML')
00065         self.failUnless(command.has_key('params'))
00066         params = result[0]['params']
00067         self.failUnless(params.has_key('html'))
00068         html = params['html']
00069         self.failUnless('portletNavigationTree' in html)
00070         self.failUnless(command.has_key('selectorType'))
00071         self.assertEqual(command['selectorType'], 'htmlid')

Here is the call graph for this function:

Definition at line 80 of file test_part_reloading.py.

00080 
00081     def test_update_of_recent_portlet(self):
00082         # there is no recent portlet now at all, so we need to create one
00083         # in the front page so we can test it.
00084         self.create_portlet(u'recent', RecentAssignment())
00085         #
00086         descriptor = lifecycleevent.Attributes(IPortalObject, 'title')
00087         modified_event = ObjectEditedEvent(self.folder, descriptor)
00088         attributesTriggerRecentPortletReload(self.folder, self.view, modified_event)
00089         result = self.view.render()
00090         command = result[0]
00091         self.failUnless(command.has_key('selector'))
00092         self.failUnless(command['selector'].startswith('portletwrapper'))
00093         self.failUnless(command.has_key('name'))
00094         self.assertEqual(command['name'], 'replaceInnerHTML')
00095         self.failUnless(command.has_key('params'))
00096         params = result[0]['params']
00097         self.failUnless(params.has_key('html'))
00098         html = params['html']
00099         self.failUnless('portletRecent' in html)
00100         self.failUnless(command.has_key('selectorType'))
00101         self.assertEqual(command['selectorType'], 'htmlid')

Here is the call graph for this function:


Member Data Documentation

Definition at line 25 of file kss_and_plone_layer.py.

Reimplemented from kss.core.tests.base.KSSViewTestCaseMixin.

Definition at line 36 of file test_part_reloading.py.


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