Back to index

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


Member Function Documentation

Definition at line 905 of file testJSRegistry.py.

00905 
00906     def afterSetUp(self):
00907         self.tool = getattr(self.portal, JSTOOLNAME)
00908         self.skins_tool = getToolByName(self.portal, 'portal_skins')
00909         self.tool.clearResources()
00910         self.portalpath = '/' + getToolByName(self.portal, 'portal_url')(1)
00911         self.toolpath = '/' + self.tool.absolute_url(1)

Definition at line 932 of file testJSRegistry.py.

00932 
00933     def testCachingHeadersFromSkin(self):
00934         self.tool.registerScript('ham')
00935         # Publish in normal mode
00936         skinpath = self.skins_tool.getDefaultSkin()
00937         url = '%s/%s/ham' % (self.toolpath, skinpath)
00938         response = self.publish(url)
00939         now = DateTime()
00940         days = 7
00941         soon = now + days
00942         self.assertEqual(response.getStatus(), 200)
00943         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
00944         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
00945 
00946         # Publish again
00947         response = self.publish(url)
00948         now = DateTime()
00949         days = 7
00950         soon = now + days
00951         self.assertEqual(response.getStatus(), 200)
00952         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
00953         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))

Definition at line 977 of file testJSRegistry.py.

00977 
00978     def testCachingHeadersFromSkinWithRAMCache(self):
00979         ram_cache_id = 'RAMCache'
00980         self.tool.ZCacheable_setManagerId(ram_cache_id)
00981         self.tool.ZCacheable_setEnabled(1)
00982         self.tool.registerScript('ham')
00983         # Publish in normal mode
00984         skinpath = self.skins_tool.getDefaultSkin()
00985         url = '%s/%s/ham' % (self.toolpath, skinpath)
00986         response = self.publish(url)
00987         now = DateTime()
00988         days = 7
00989         soon = now + days
00990         self.assertEqual(response.getStatus(), 200)
00991         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
00992         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
00993 
00994         # Publish again
00995         response = self.publish(url)
00996         now = DateTime()
00997         days = 7
00998         soon = now + days
00999         self.assertEqual(response.getStatus(), 200)
01000         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
01001         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
01002 

Definition at line 912 of file testJSRegistry.py.

00912 
00913     def testCachingHeadersFromTool(self):
00914         self.tool.registerScript('ham')
00915         # Publish
00916         response = self.publish(self.toolpath+'/ham')
00917         now = DateTime()
00918         days = 7
00919         soon = now + days
00920         self.assertEqual(response.getStatus(), 200)
00921         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
00922         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
00923 
00924         # Publish again
00925         response = self.publish(self.toolpath+'/ham')
00926         now = DateTime()
00927         days = 7
00928         soon = now + days
00929         self.assertEqual(response.getStatus(), 200)
00930         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
00931         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))

Definition at line 954 of file testJSRegistry.py.

00954 
00955     def testCachingHeadersFromToolWithRAMCache(self):
00956         ram_cache_id = 'RAMCache'
00957         self.tool.ZCacheable_setManagerId(ram_cache_id)
00958         self.tool.ZCacheable_setEnabled(1)
00959         self.tool.registerScript('ham')
00960         # Publish
00961         response = self.publish(self.toolpath+'/ham')
00962         now = DateTime()
00963         days = 7
00964         soon = now + days
00965         self.assertEqual(response.getStatus(), 200)
00966         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
00967         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))
00968 
00969         # Publish again
00970         response = self.publish(self.toolpath+'/ham')
00971         now = DateTime()
00972         days = 7
00973         soon = now + days
00974         self.assertEqual(response.getStatus(), 200)
00975         self.assertEqual(response.getHeader('Expires'), rfc1123_date(soon.timeTime()))
00976         self.assertEqual(response.getHeader('Cache-Control'), 'max-age=%d' % int(days*24*3600))


Member Data Documentation

Definition at line 909 of file testJSRegistry.py.

Definition at line 907 of file testJSRegistry.py.

Definition at line 906 of file testJSRegistry.py.

Definition at line 910 of file testJSRegistry.py.


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