Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testDefaultKineticStylesheetCookableAttribute
def testKineticStylesheetCookableAttribute
def testNumberOfResources
def testCompositionWithLastUncooked
def testCompositionWithFirstUncooked
def testCompositionWithMiddleUncooked
def testLargerCompositionWithMiddleUncooked

Public Attributes

 tool

Detailed Description

Definition at line 493 of file testKSSRegistry.py.


Member Function Documentation

Definition at line 495 of file testKSSRegistry.py.

00495 
00496     def afterSetUp(self):
00497         self.tool = getattr(self.portal, KSSTOOLNAME)
00498         self.tool.clearResources()
00499         self.tool.registerKineticStylesheet('testroot.kss')
00500         self.tool.registerKineticStylesheet('test_rr_1.kss')
00501         self.tool.registerKineticStylesheet('test_rr_2.kss', cookable=False)
00502         self.setRoles(['Manager'])
00503         self.portal.invokeFactory('File',
00504                                    id='testroot.kss',
00505                                    format='text/css',
00506                                    content_type='text/css',
00507                                    file='body { background-color : green }')
00508         self.setRoles(['Member'])

Definition at line 547 of file testKSSRegistry.py.

00547 
00548     def testCompositionWithFirstUncooked(self):
00549         self.tool.moveResourceToTop('test_rr_2.kss')
00550         self.assertEqual(len(self.tool.getResources()), 3)
00551         self.assertEqual(len(self.tool.cookedresources), 2)
00552         self.assertEqual(len(self.tool.concatenatedresources), 5)
00553         styles = self.tool.getEvaluatedResources(self.portal)
00554         self.assertEqual(len(styles), 2)
00555         magicId = None
00556         for style in styles:
00557             id = style.getId()
00558             if '-cachekey' in id:
00559                 magicId = id
00560         self.failUnless(magicId)
00561         content = str(self.portal.restrictedTraverse('portal_kss/%s' % magicId))
00562         self.failUnless('red' in content)
00563         self.failUnless('green' in content)
00564         self.failIf('blue' in content)
00565         content = str(self.portal.restrictedTraverse('portal_kss/test_rr_2.kss'))
00566         self.failUnless('blue' in content)

Here is the call graph for this function:

Definition at line 523 of file testKSSRegistry.py.

00523 
00524     def testCompositionWithLastUncooked(self):
00525         self.tool.moveResourceToBottom('test_rr_2.kss')
00526         self.assertEqual(len(self.tool.getResources()), 3)
00527         self.assertEqual(len(self.tool.cookedresources), 2)
00528         self.assertEqual(len(self.tool.concatenatedresources), 5)
00529         styles = self.tool.getEvaluatedResources(self.portal)
00530         self.assertEqual(len(styles), 2)
00531         magicIds = []
00532         for style in styles:
00533             id = style.getId()
00534             if '-cachekey' in id:
00535                 magicIds.append(id)
00536         self.failUnless(magicIds[-1].startswith('test_rr_2'))
00537         content = str(self.portal.restrictedTraverse('portal_kss/%s' % magicIds[-2]))
00538         self.failUnless('red' in content)
00539         self.failUnless('green' in content)
00540         self.failIf('blue' in content)
00541         content = str(self.portal.restrictedTraverse('portal_kss/%s' % magicIds[-1]))
00542         self.failIf('red' in content)
00543         self.failIf('green' in content)
00544         self.failUnless('blue' in content)
00545         content = str(self.portal.restrictedTraverse('portal_kss/test_rr_2.kss'))
00546         self.failUnless('blue' in content)

Here is the call graph for this function:

Definition at line 567 of file testKSSRegistry.py.

00567 
00568     def testCompositionWithMiddleUncooked(self):
00569         self.tool.moveResourceToTop('test_rr_2.kss')
00570         self.tool.moveResourceDown('test_rr_2.kss')
00571         self.assertEqual(len(self.tool.getResources()), 3)
00572         self.assertEqual(len(self.tool.cookedresources), 3)
00573         self.assertEqual(len(self.tool.concatenatedresources), 6)
00574         styles = self.tool.getEvaluatedResources(self.portal)
00575         self.assertEqual(len(styles), 3)
00576         content = str(self.portal.restrictedTraverse('portal_kss/test_rr_2.kss'))
00577         self.failUnless('blue' in content)
00578         content = str(self.portal.restrictedTraverse('portal_kss/test_rr_1.kss'))
00579         self.failUnless('red' in content)
00580         content = str(self.portal.restrictedTraverse('portal_kss/testroot.kss'))
00581         self.failUnless('green' in content)

Here is the call graph for this function:

Definition at line 509 of file testKSSRegistry.py.

00509 
00510     def testDefaultKineticStylesheetCookableAttribute(self):
00511         self.failUnless(self.tool.getResources()[self.tool.getResourcePosition('test_rr_1.kss')].getCookable())
00512         self.failUnless(self.tool.getResources()[self.tool.getResourcePosition('testroot.kss')].getCookable())

Definition at line 513 of file testKSSRegistry.py.

00513 
00514     def testKineticStylesheetCookableAttribute(self):
00515         self.failIf(self.tool.getResources()[self.tool.getResourcePosition('test_rr_2.kss')].getCookable())

Definition at line 582 of file testKSSRegistry.py.

00582 
00583     def testLargerCompositionWithMiddleUncooked(self):
00584         self.setRoles(['Manager'])
00585         self.portal.invokeFactory('File',
00586                                    id='testpurple.kss',
00587                                    format='text/css',
00588                                    content_type='text/css',
00589                                    file='body { background-color : purple }')
00590         self.portal.invokeFactory('File',
00591                                    id='testpink.kss',
00592                                    format='text/css',
00593                                    content_type='text/css',
00594                                    file='body { background-color : pink }')
00595         self.setRoles(['Member'])
00596         self.tool.registerKineticStylesheet('testpurple.kss')
00597         self.tool.registerKineticStylesheet('testpink.kss')
00598         self.tool.moveResourceToTop('test_rr_2.kss')
00599         self.tool.moveResourceDown('test_rr_2.kss', 2)
00600         #Now have [[green,red],blue,[purple,pink]]
00601         self.assertEqual(len(self.tool.getResources()), 5)
00602         self.assertEqual(len(self.tool.cookedresources), 3)
00603         self.assertEqual(len(self.tool.concatenatedresources), 8)
00604         styles = self.tool.getEvaluatedResources(self.portal)
00605         self.assertEqual(len(styles), 3)
00606         magicIds = []
00607         for style in styles:
00608             id = style.getId()
00609             if '-cachekey' in id:
00610                 magicIds.append(id)
00611         self.assertEqual(len(magicIds), 3)
00612         content = str(self.portal.restrictedTraverse('portal_kss/%s' % magicIds[0]))
00613         self.failUnless('red' in content)
00614         self.failUnless('green' in content)
00615         self.failIf('pink' in content)
00616         self.failIf('purple' in content)
00617         content = str(self.portal.restrictedTraverse('portal_kss/%s' % magicIds[2]))
00618         self.failUnless('pink' in content)
00619         self.failUnless('purple' in content)
00620         self.failIf('red' in content)
00621         self.failIf('green' in content)
00622         content = str(self.portal.restrictedTraverse('portal_kss/test_rr_2.kss'))
00623         self.failUnless('blue' in content)

Here is the call graph for this function:

Definition at line 516 of file testKSSRegistry.py.

00516 
00517     def testNumberOfResources(self):
00518         self.assertEqual(len(self.tool.getResources()), 3)
00519         self.assertEqual(len(self.tool.cookedresources), 2)
00520         self.assertEqual(len(self.tool.concatenatedresources), 5)
00521         styles = self.tool.getEvaluatedResources(self.portal)
00522         self.assertEqual(len(styles), 2)

Here is the call graph for this function:


Member Data Documentation

Definition at line 496 of file testKSSRegistry.py.


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