Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testDefaultStylesheetCookableAttribute
def testStylesheetCookableAttribute
def testNumberOfResources
def testCompositionWithLastUncooked
def testCompositionWithFirstUncooked
def testCompositionWithMiddleUncooked
def testLargerCompositionWithMiddleUncooked

Public Attributes

 tool

Detailed Description

Definition at line 610 of file testCSSRegistry.py.


Member Function Documentation

Definition at line 612 of file testCSSRegistry.py.

00612 
00613     def afterSetUp(self):
00614         self.tool = getattr(self.portal, CSSTOOLNAME)
00615         self.tool.clearResources()
00616         self.tool.registerStylesheet('testroot.css')
00617         self.tool.registerStylesheet('test_rr_1.css')
00618         self.tool.registerStylesheet('test_rr_2.css', cookable=False)
00619         self.setRoles(['Manager'])
00620         self.portal.invokeFactory('File',
00621                                    id='testroot.css',
00622                                    format='text/css',
00623                                    content_type='text/css',
00624                                    file='body { background-color : green }')
00625         self.setRoles(['Member'])

Definition at line 664 of file testCSSRegistry.py.

00664 
00665     def testCompositionWithFirstUncooked(self):
00666         self.tool.moveResourceToTop('test_rr_2.css')
00667         self.assertEqual(len(self.tool.getResources()), 3)
00668         self.assertEqual(len(self.tool.cookedresources), 2)
00669         self.assertEqual(len(self.tool.concatenatedresources), 5)
00670         styles = self.tool.getEvaluatedResources(self.portal)
00671         self.assertEqual(len(styles), 2)
00672         magicId = None
00673         for style in styles:
00674             id = style.getId()
00675             if '-cachekey' in id:
00676                 magicId = id
00677         self.failUnless(magicId)
00678         content = str(self.portal.restrictedTraverse('portal_css/%s' % magicId))
00679         self.failUnless('red' in content)
00680         self.failUnless('green' in content)
00681         self.failIf('blue' in content)
00682         content = str(self.portal.restrictedTraverse('portal_css/test_rr_2.css'))
00683         self.failUnless('blue' in content)

Here is the call graph for this function:

Definition at line 640 of file testCSSRegistry.py.

00640 
00641     def testCompositionWithLastUncooked(self):
00642         self.tool.moveResourceToBottom('test_rr_2.css')
00643         self.assertEqual(len(self.tool.getResources()), 3)
00644         self.assertEqual(len(self.tool.cookedresources), 2)
00645         self.assertEqual(len(self.tool.concatenatedresources), 5)
00646         styles = self.tool.getEvaluatedResources(self.portal)
00647         self.assertEqual(len(styles), 2)
00648         magicIds = []
00649         for style in styles:
00650             id = style.getId()
00651             if '-cachekey' in id:
00652                 magicIds.append(id)
00653         self.failUnless(magicIds[-1].startswith('test_rr_2'))
00654         content = str(self.portal.restrictedTraverse('portal_css/%s' % magicIds[-2]))
00655         self.failUnless('red' in content)
00656         self.failUnless('green' in content)
00657         self.failIf('blue' in content)
00658         content = str(self.portal.restrictedTraverse('portal_css/%s' % magicIds[-1]))
00659         self.failIf('red' in content)
00660         self.failIf('green' in content)
00661         self.failUnless('blue' in content)
00662         content = str(self.portal.restrictedTraverse('portal_css/test_rr_2.css'))
00663         self.failUnless('blue' in content)

Here is the call graph for this function:

Definition at line 684 of file testCSSRegistry.py.

00684 
00685     def testCompositionWithMiddleUncooked(self):
00686         self.tool.moveResourceToTop('test_rr_2.css')
00687         self.tool.moveResourceDown('test_rr_2.css')
00688         self.assertEqual(len(self.tool.getResources()), 3)
00689         self.assertEqual(len(self.tool.cookedresources), 3)
00690         self.assertEqual(len(self.tool.concatenatedresources), 6)
00691         styles = self.tool.getEvaluatedResources(self.portal)
00692         self.assertEqual(len(styles), 3)
00693         content = str(self.portal.restrictedTraverse('portal_css/test_rr_2.css'))
00694         self.failUnless('blue' in content)
00695         content = str(self.portal.restrictedTraverse('portal_css/test_rr_1.css'))
00696         self.failUnless('red' in content)
00697         content = str(self.portal.restrictedTraverse('portal_css/testroot.css'))
00698         self.failUnless('green' in content)

Here is the call graph for this function:

Definition at line 626 of file testCSSRegistry.py.

00626 
00627     def testDefaultStylesheetCookableAttribute(self):
00628         self.failUnless(self.tool.getResources()[self.tool.getResourcePosition('test_rr_1.css')].getCookable())
00629         self.failUnless(self.tool.getResources()[self.tool.getResourcePosition('testroot.css')].getCookable())

Definition at line 699 of file testCSSRegistry.py.

00699 
00700     def testLargerCompositionWithMiddleUncooked(self):
00701         self.setRoles(['Manager'])
00702         self.portal.invokeFactory('File',
00703                                    id='testpurple.css',
00704                                    format='text/css',
00705                                    content_type='text/css',
00706                                    file='body { background-color : purple }')
00707         self.portal.invokeFactory('File',
00708                                    id='testpink.css',
00709                                    format='text/css',
00710                                    content_type='text/css',
00711                                    file='body { background-color : pink }')
00712         self.setRoles(['Member'])
00713         self.tool.registerStylesheet('testpurple.css')
00714         self.tool.registerStylesheet('testpink.css')
00715         self.tool.moveResourceToTop('test_rr_2.css')
00716         self.tool.moveResourceDown('test_rr_2.css', 2)
00717         #Now have [[green,red],blue,[purple,pink]]
00718         self.assertEqual(len(self.tool.getResources()), 5)
00719         self.assertEqual(len(self.tool.cookedresources), 3)
00720         self.assertEqual(len(self.tool.concatenatedresources), 8)
00721         styles = self.tool.getEvaluatedResources(self.portal)
00722         self.assertEqual(len(styles), 3)
00723         magicIds = []
00724         for style in styles:
00725             id = style.getId()
00726             if '-cachekey' in id:
00727                 magicIds.append(id)
00728         self.assertEqual(len(magicIds), 3)
00729         content = str(self.portal.restrictedTraverse('portal_css/%s' % magicIds[0]))
00730         self.failUnless('red' in content)
00731         self.failUnless('green' in content)
00732         self.failIf('pink' in content)
00733         self.failIf('purple' in content)
00734         content = str(self.portal.restrictedTraverse('portal_css/%s' % magicIds[2]))
00735         self.failUnless('pink' in content)
00736         self.failUnless('purple' in content)
00737         self.failIf('red' in content)
00738         self.failIf('green' in content)
00739         content = str(self.portal.restrictedTraverse('portal_css/test_rr_2.css'))
00740         self.failUnless('blue' in content)

Here is the call graph for this function:

Definition at line 633 of file testCSSRegistry.py.

00633 
00634     def testNumberOfResources(self):
00635         self.assertEqual(len(self.tool.getResources()), 3)
00636         self.assertEqual(len(self.tool.cookedresources), 2)
00637         self.assertEqual(len(self.tool.concatenatedresources), 5)
00638         styles = self.tool.getEvaluatedResources(self.portal)
00639         self.assertEqual(len(styles), 2)

Here is the call graph for this function:

Definition at line 630 of file testCSSRegistry.py.

00630 
00631     def testStylesheetCookableAttribute(self):
00632         self.failIf(self.tool.getResources()[self.tool.getResourcePosition('test_rr_2.css')].getCookable())


Member Data Documentation

Definition at line 613 of file testCSSRegistry.py.


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