Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testUnauthorizedGetItem
def testUnauthorizedTraversal
def testUnauthorizedOnPublish
def testRemovedFromResources
def testRemovedFromMergedResources
def testAuthorizedGetItem
def testAuthorizedTraversal
def testAuthorizedOnPublish

Public Attributes

 tool
 toolpath

Detailed Description

Definition at line 807 of file testCSSRegistry.py.


Member Function Documentation

Definition at line 809 of file testCSSRegistry.py.

00809 
00810     def afterSetUp(self):
00811         self.tool = getattr(self.portal, CSSTOOLNAME)
00812         self.toolpath = '/' + self.tool.absolute_url(1)
00813         self.tool.clearResources()
00814         self.tool.registerStylesheet('testroot.css', cookable=False)
00815         self.tool.registerStylesheet('test_rr_1.css')
00816         self.setRoles(['Manager'])
00817         self.portal.invokeFactory('File',
00818                                    id='testroot.css',
00819                                    format='text/css',
00820                                    content_type='text/css',
00821                                    file='body { background-color : green }')
00822 
00823         stylesheet = getattr(self.portal, 'testroot.css')
00824 
00825         stylesheet.manage_permission('View',['Manager'], acquire=0)
00826         stylesheet.manage_permission('Access contents information',['Manager'], acquire=0)
00827         self.setRoles(['Member'])
00828 

Definition at line 872 of file testCSSRegistry.py.

00872 
00873     def testAuthorizedGetItem(self):
00874         self.setRoles(['Manager'])
00875         try:
00876             content = str(self.tool['testroot.css'])
00877         except Unauthorized:
00878             self.fail()

Here is the call graph for this function:

Definition at line 886 of file testCSSRegistry.py.

00886 
00887     def testAuthorizedOnPublish(self):
00888         authstr = "%s:%s" % (portal_owner, default_password)
00889         response = self.publish(self.toolpath + '/testroot.css', basic=authstr)
00890         self.failUnlessEqual(response.getStatus(), 200)

Definition at line 879 of file testCSSRegistry.py.

00879 
00880     def testAuthorizedTraversal(self):
00881         self.setRoles(['Manager'])
00882         try:
00883             content = str(self.portal.restrictedTraverse('portal_css/testroot.css'))
00884         except Unauthorized:
00885             self.fail()

Here is the call graph for this function:

Definition at line 857 of file testCSSRegistry.py.

00857 
00858     def testRemovedFromMergedResources(self):
00859         self.tool.unregisterResource('testroot.css')
00860         self.tool.registerStylesheet('testroot.css')
00861         styles = self.tool.getEvaluatedResources(self.portal)
00862         magicId = None
00863         for style in styles:
00864             id = style.getId()
00865             if '-cachekey' in id:
00866                 magicId = id
00867         self.failUnless(magicId)
00868         content = str(self.portal.restrictedTraverse('portal_css/%s' % magicId))
00869         self.failIf('green' in content)
00870         self.failUnless('not authorized' in content)
00871         self.failUnless('red' in content)

Here is the call graph for this function:

Definition at line 850 of file testCSSRegistry.py.

00850 
00851     def testRemovedFromResources(self):
00852         styles = self.tool.getEvaluatedResources(self.portal)
00853         ids = [item.getId() for item in styles]
00854         self.assertEqual(len(self.tool.concatenatedresources), 4)
00855         self.failIf('testroot.css' in ids)
00856         self.failUnless('test_rr_1.css' in self.tool.concatenatedresources[ids[1]])

Here is the call graph for this function:

Definition at line 829 of file testCSSRegistry.py.

00829 
00830     def testUnauthorizedGetItem(self):
00831         try:
00832             content = str(self.tool['testroot.css'])
00833         except Unauthorized:
00834             return
00835 
00836         self.fail()

Here is the call graph for this function:

Definition at line 845 of file testCSSRegistry.py.

00845 
00846     def testUnauthorizedOnPublish(self):
00847         response = self.publish(self.toolpath + '/testroot.css')
00848         #Will be 302 if CookieCrumbler is enabled
00849         self.failUnless(response.getStatus() in [302, 403, 401])

Definition at line 837 of file testCSSRegistry.py.

00837 
00838     def testUnauthorizedTraversal(self):
00839         try:
00840             content = str(self.portal.restrictedTraverse('portal_css/testroot.css'))
00841         except Unauthorized:
00842             return
00843 
00844         self.fail()

Here is the call graph for this function:


Member Data Documentation

Definition at line 810 of file testCSSRegistry.py.

Definition at line 811 of file testCSSRegistry.py.


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