Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testCachingHeadersFromTool
def testCachingHeadersFromSkin
def testCachingHeadersFromToolWithRAMCache
def testCachingHeadersFromSkinWithRAMCache

Public Attributes

 tool
 skins_tool
 portalpath
 toolpath

Detailed Description

Definition at line 1022 of file testCSSRegistry.py.


Member Function Documentation

Definition at line 1023 of file testCSSRegistry.py.

01023 
01024     def afterSetUp(self):
01025         self.tool = getattr(self.portal, CSSTOOLNAME)
01026         self.skins_tool = getToolByName(self.portal, 'portal_skins')
01027         self.tool.clearResources()
01028         self.portalpath = '/' + getToolByName(self.portal, 'portal_url')(1)
01029         self.toolpath = '/' + self.tool.absolute_url(1)

Definition at line 1050 of file testCSSRegistry.py.

01050 
01051     def testCachingHeadersFromSkin(self):
01052         self.tool.registerStylesheet('ham')
01053         # Publish in normal mode
01054         skinpath = self.skins_tool.getDefaultSkin()
01055         url = '%s/%s/ham' % (self.toolpath, skinpath)
01056         response = self.publish(url)
01057         now = DateTime()
01058         days = 7
01059         soon = now + days
01060         self.assertEqual(response.getStatus(), 200)
01061         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01062         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
01063 
01064         # Publish again
01065         response = self.publish(url)
01066         now = DateTime()
01067         days = 7
01068         soon = now + days
01069         self.assertEqual(response.getStatus(), 200)
01070         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01071         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))

Definition at line 1095 of file testCSSRegistry.py.

01095 
01096     def testCachingHeadersFromSkinWithRAMCache(self):
01097         ram_cache_id = 'RAMCache'
01098         self.tool.ZCacheable_setManagerId(ram_cache_id)
01099         self.tool.ZCacheable_setEnabled(1)
01100         self.tool.registerStylesheet('ham')
01101         # Publish in normal mode
01102         skinpath = self.skins_tool.getDefaultSkin()
01103         url = '%s/%s/ham' % (self.toolpath, skinpath)
01104         response = self.publish(url)
01105         now = DateTime()
01106         days = 7
01107         soon = now + days
01108         self.assertEqual(response.getStatus(), 200)
01109         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01110         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
01111 
01112         # Publish again
01113         response = self.publish(url)
01114         now = DateTime()
01115         days = 7
01116         soon = now + days
01117         self.assertEqual(response.getStatus(), 200)
01118         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01119         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
01120 

Definition at line 1030 of file testCSSRegistry.py.

01030 
01031     def testCachingHeadersFromTool(self):
01032         self.tool.registerStylesheet('ham')
01033         # Publish
01034         response = self.publish(self.toolpath+'/ham')
01035         now = DateTime()
01036         days = 7
01037         soon = now + days
01038         self.assertEqual(response.getStatus(), 200)
01039         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01040         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
01041 
01042         # Publish again
01043         response = self.publish(self.toolpath+'/ham')
01044         now = DateTime()
01045         days = 7
01046         soon = now + days
01047         self.assertEqual(response.getStatus(), 200)
01048         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01049         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))

Definition at line 1072 of file testCSSRegistry.py.

01072 
01073     def testCachingHeadersFromToolWithRAMCache(self):
01074         ram_cache_id = 'RAMCache'
01075         self.tool.ZCacheable_setManagerId(ram_cache_id)
01076         self.tool.ZCacheable_setEnabled(1)
01077         self.tool.registerStylesheet('ham')
01078         # Publish
01079         response = self.publish(self.toolpath+'/ham')
01080         now = DateTime()
01081         days = 7
01082         soon = now + days
01083         self.assertEqual(response.getStatus(), 200)
01084         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01085         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
01086 
01087         # Publish again
01088         response = self.publish(self.toolpath+'/ham')
01089         now = DateTime()
01090         days = 7
01091         soon = now + days
01092         self.assertEqual(response.getStatus(), 200)
01093         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01094         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))


Member Data Documentation

Definition at line 1027 of file testCSSRegistry.py.

Definition at line 1025 of file testCSSRegistry.py.

Definition at line 1024 of file testCSSRegistry.py.

Definition at line 1028 of file testCSSRegistry.py.


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