[CMF-checkins] CVS: Products/CMFCore/tests - test_FSFile.py:1.4.14.4 test_FSImage.py:1.7.14.3

Florent Guillaume fg at nuxeo.com
Sun Nov 14 18:15:06 EST 2004


Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv12476/CMFCore/tests

Modified Files:
      Tag: CMF-1_4-branch
	test_FSFile.py test_FSImage.py 
Log Message:
FSFile, FSImage: Made available to caching policy manager as
standard content (Collector #299).


=== Products/CMFCore/tests/test_FSFile.py 1.4.14.3 => 1.4.14.4 ===
--- Products/CMFCore/tests/test_FSFile.py:1.4.14.3	Fri Apr 23 17:11:35 2004
+++ Products/CMFCore/tests/test_FSFile.py	Sun Nov 14 18:15:06 2004
@@ -4,7 +4,10 @@
 
 class DummyCachingManager:
     def getHTTPCachingHeaders( self, content, view_name, keywords, time=None ):
-        return ( ( 'foo', 'Foo' ), ( 'bar', 'Bar' ) )
+        return (
+            ('foo', 'Foo'), ('bar', 'Bar'),
+            ('test_path', '/'.join(content.getPhysicalPath())),
+            )
 
 from Products.CMFCore.tests.base.testcase import RequestTest, FSDVTest
 
@@ -118,6 +121,18 @@
 
         self.failUnless( data, '' )
         self.assertEqual( self.RESPONSE.getStatus(), 200 )
+
+    def test_caching( self ):
+        self.root.caching_policy_manager = DummyCachingManager()
+        original_len = len(self.RESPONSE.headers)
+        file = self._makeOne('test_file', 'test_file.swf')
+        file = file.__of__(self.root)
+        file.index_html(self.REQUEST, self.RESPONSE)
+        headers = self.RESPONSE.headers
+        self.failUnless(len(headers) >= original_len + 3)
+        self.failUnless('foo' in headers.keys())
+        self.failUnless('bar' in headers.keys())
+        self.assertEqual(headers['test_path'], '/test_file')
 
 def test_suite():
     return unittest.TestSuite((


=== Products/CMFCore/tests/test_FSImage.py 1.7.14.2 => 1.7.14.3 ===
--- Products/CMFCore/tests/test_FSImage.py:1.7.14.2	Fri Apr 23 17:11:35 2004
+++ Products/CMFCore/tests/test_FSImage.py	Sun Nov 14 18:15:06 2004
@@ -4,7 +4,10 @@
 
 class DummyCachingManager:
     def getHTTPCachingHeaders( self, content, view_name, keywords, time=None ):
-        return ( ( 'foo', 'Foo' ), ( 'bar', 'Bar' ) )
+        return (
+            ('foo', 'Foo'), ('bar', 'Bar'),
+            ('test_path', '/'.join(content.getPhysicalPath())),
+            )
 
 from Products.CMFCore.tests.base.testcase import RequestTest, FSDVTest
 
@@ -112,6 +115,18 @@
 
         self.failUnless( data, '' )
         self.assertEqual( self.RESPONSE.getStatus(), 200 )
+
+    def test_caching( self ):
+        self.root.caching_policy_manager = DummyCachingManager()
+        original_len = len(self.RESPONSE.headers)
+        image = self._makeOne('test_image', 'test_image.gif')
+        image = image.__of__(self.root)
+        image.index_html(self.REQUEST, self.RESPONSE)
+        headers = self.RESPONSE.headers
+        self.failUnless(len(headers) >= original_len + 3)
+        self.failUnless('foo' in headers.keys())
+        self.failUnless('bar' in headers.keys())
+        self.assertEqual(headers['test_path'], '/test_image')
 
 def test_suite():
     return unittest.TestSuite((



More information about the CMF-checkins mailing list