Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ResourceRegistries.tests.testCSSRegistry.TestZODBTraversal Class Reference
Inheritance diagram for ResourceRegistries.tests.testCSSRegistry.TestZODBTraversal:
Inheritance graph
[legend]
Collaboration diagram for ResourceRegistries.tests.testCSSRegistry.TestZODBTraversal:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testGetItemTraversal
def testGetItemTraversalContent
def testRestrictedTraverseContent
def testRestrictedTraverseComposition
def testContextDependantInlineCSS

Public Attributes

 tool

Detailed Description

Definition at line 528 of file testCSSRegistry.py.


Member Function Documentation

Definition at line 530 of file testCSSRegistry.py.

00530 
00531     def afterSetUp(self):
00532         self.tool = getattr(self.portal, CSSTOOLNAME)
00533         self.tool.clearResources()
00534         self.setRoles(['Manager'])
00535         self.portal.invokeFactory('File',
00536                                    id='testroot.css',
00537                                    format='text/css',
00538                                    content_type='text/css',
00539                                    file='body { background-color : red }')
00540         self.portal.invokeFactory('Folder', 'subfolder')
00541         self.portal.subfolder.invokeFactory('File',
00542                                    id='testsubfolder.css',
00543                                    format='text/css',
00544                                    content_type='text/css',
00545                                    file='body { background-color : blue }')
00546 
00547         self.tool.registerStylesheet('testroot.css')
00548         self.tool.registerStylesheet('subfolder/testsubfolder.css')
00549         self.setRoles(['Member'])

Definition at line 580 of file testCSSRegistry.py.

00580 
00581     def testContextDependantInlineCSS(self):
00582         self.tool.clearResources()
00583         self.setRoles(['Manager'])
00584         self.portal.invokeFactory('Folder', 'folder1')
00585         self.portal.invokeFactory('Folder', 'folder2')
00586         self.portal.folder1.invokeFactory('File',
00587                                    id='context.css',
00588                                    format='text/css',
00589                                    content_type='text/css',
00590                                    file='body { background-color : pink }')
00591         self.portal.folder2.invokeFactory('File',
00592                                    id='context.css',
00593                                    format='text/css',
00594                                    content_type='text/css',
00595                                    file='body { background-color : purple }')
00596         self.tool.registerStylesheet('context.css', rendering='inline')
00597         self.setRoles(['Member'])
00598         view = self.portal.restrictedTraverse('@@plone')
00599         viewletmanager = getMultiAdapter((self.portal.folder1, self.portal.folder1.REQUEST, view), IContentProvider, name = u'plone.resourceregistries.styles')
00600         viewletmanager.update()
00601         content = viewletmanager.render()
00602         self.failUnless('pink' in content)
00603         self.failIf('purple' in content)
00604         view = self.portal.restrictedTraverse('@@plone')
00605         viewletmanager = getMultiAdapter((self.portal.folder2, self.portal.folder2.REQUEST, view), IContentProvider, name = u'plone.resourceregistries.styles')
00606         viewletmanager.update()
00607         content = viewletmanager.render()
00608         self.failUnless('purple' in content)
00609         self.failIf('pink' in content)

Here is the call graph for this function:

Definition at line 550 of file testCSSRegistry.py.

00550 
00551     def testGetItemTraversal(self):
00552         self.failUnless(self.tool['testroot.css'])
00553         self.failUnless(self.tool['subfolder/testsubfolder.css'])

Definition at line 554 of file testCSSRegistry.py.

00554 
00555     def testGetItemTraversalContent(self):
00556         self.failUnless('red' in str(self.tool['testroot.css']))
00557         self.failUnless('blue' in str(self.tool['subfolder/testsubfolder.css']))
00558         self.failIf('blue' in str(self.tool['testroot.css']))
00559         self.failIf('red' in str(self.tool['subfolder/testsubfolder.css']))
00560 

Definition at line 571 of file testCSSRegistry.py.

00571 
00572     def testRestrictedTraverseComposition(self):
00573         styles = self.tool.getEvaluatedResources(self.portal)
00574         self.assertEqual(len(styles), 1)
00575         magicId = styles[0].getId()
00576         content = str(self.portal.restrictedTraverse('portal_css/%s' % magicId))
00577         self.failUnless('background-color' in content)
00578         self.failUnless('red' in content)
00579         self.failUnless('blue' in content)

Here is the call graph for this function:

Definition at line 561 of file testCSSRegistry.py.

00561 
00562     def testRestrictedTraverseContent(self):
00563         self.failUnless('red' in str(
00564                         self.portal.restrictedTraverse('portal_css/testroot.css')))
00565         self.failUnless('blue' in str(
00566                         self.portal.restrictedTraverse('portal_css/subfolder/testsubfolder.css')))
00567         self.failIf('blue' in str(
00568                         self.portal.restrictedTraverse('portal_css/testroot.css')))
00569         self.failIf('red' in str(
00570                         self.portal.restrictedTraverse('portal_css/subfolder/testsubfolder.css')))


Member Data Documentation

Definition at line 531 of file testCSSRegistry.py.


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