Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ResourceRegistries.tests.testKSSRegistry.TestResourcePermissions Class Reference
Inheritance diagram for ResourceRegistries.tests.testKSSRegistry.TestResourcePermissions:
Inheritance graph
[legend]
Collaboration diagram for ResourceRegistries.tests.testKSSRegistry.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 675 of file testKSSRegistry.py.


Member Function Documentation

Definition at line 677 of file testKSSRegistry.py.

00677 
00678     def afterSetUp(self):
00679         self.tool = getattr(self.portal, KSSTOOLNAME)
00680         self.toolpath = '/' + self.tool.absolute_url(1)
00681         self.tool.clearResources()
00682         self.tool.registerKineticStylesheet('testroot.kss', cookable=False)
00683         self.tool.registerKineticStylesheet('test_rr_1.kss')
00684         self.setRoles(['Manager'])
00685         self.portal.invokeFactory('File',
00686                                    id='testroot.kss',
00687                                    format='text/css',
00688                                    content_type='text/css',
00689                                    file='body { background-color : green }')
00690 
00691         stylesheet = getattr(self.portal, 'testroot.kss')
00692 
00693         stylesheet.manage_permission('View',['Manager'], acquire=0)
00694         stylesheet.manage_permission('Access contents information',['Manager'], acquire=0)
00695         self.setRoles(['Member'])
00696 

Definition at line 740 of file testKSSRegistry.py.

00740 
00741     def testAuthorizedGetItem(self):
00742         self.setRoles(['Manager'])
00743         try:
00744             content = str(self.tool['testroot.kss'])
00745         except Unauthorized:
00746             self.fail()

Here is the call graph for this function:

Definition at line 754 of file testKSSRegistry.py.

00754 
00755     def testAuthorizedOnPublish(self):
00756         authstr = "%s:%s" % (portal_owner, default_password)
00757         response = self.publish(self.toolpath + '/testroot.kss', basic=authstr)
00758         self.failUnlessEqual(response.getStatus(), 200)

Definition at line 747 of file testKSSRegistry.py.

00747 
00748     def testAuthorizedTraversal(self):
00749         self.setRoles(['Manager'])
00750         try:
00751             content = str(self.portal.restrictedTraverse('portal_kss/testroot.kss'))
00752         except Unauthorized:
00753             self.fail()

Here is the call graph for this function:

Definition at line 725 of file testKSSRegistry.py.

00725 
00726     def testRemovedFromMergedResources(self):
00727         self.tool.unregisterResource('testroot.kss')
00728         self.tool.registerKineticStylesheet('testroot.kss')
00729         styles = self.tool.getEvaluatedResources(self.portal)
00730         magicId = None
00731         for style in styles:
00732             id = style.getId()
00733             if '-cachekey' in id:
00734                 magicId = id
00735         self.failUnless(magicId)
00736         content = str(self.portal.restrictedTraverse('portal_kss/%s' % magicId))
00737         self.failIf('green' in content)
00738         self.failUnless('not authorized' in content)
00739         self.failUnless('red' in content)

Here is the call graph for this function:

Definition at line 718 of file testKSSRegistry.py.

00718 
00719     def testRemovedFromResources(self):
00720         styles = self.tool.getEvaluatedResources(self.portal)
00721         ids = [item.getId() for item in styles]
00722         self.assertEqual(len(self.tool.concatenatedresources), 4)
00723         self.failIf('testroot.kss' in ids)
00724         self.failUnless('test_rr_1.kss' in self.tool.concatenatedresources[ids[1]])

Here is the call graph for this function:

Definition at line 697 of file testKSSRegistry.py.

00697 
00698     def testUnauthorizedGetItem(self):
00699         try:
00700             content = str(self.tool['testroot.kss'])
00701         except Unauthorized:
00702             return
00703 
00704         self.fail()

Here is the call graph for this function:

Definition at line 713 of file testKSSRegistry.py.

00713 
00714     def testUnauthorizedOnPublish(self):
00715         response = self.publish(self.toolpath + '/testroot.kss')
00716         #Will be 302 if CookieCrumbler is enabled
00717         self.failUnless(response.getStatus() in [302, 403, 401])

Definition at line 705 of file testKSSRegistry.py.

00705 
00706     def testUnauthorizedTraversal(self):
00707         try:
00708             content = str(self.portal.restrictedTraverse('portal_kss/testroot.kss'))
00709         except Unauthorized:
00710             return
00711 
00712         self.fail()

Here is the call graph for this function:


Member Data Documentation

Definition at line 678 of file testKSSRegistry.py.

Definition at line 679 of file testKSSRegistry.py.


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