[CMF-checkins] CVS: CMF/CMFCore/tests - test_FSFile.py:1.2 test_all.py:1.19

Shane Hathaway shane@cvs.zope.org
Thu, 12 Sep 2002 11:34:05 -0400


Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv32441

Modified Files:
	test_FSFile.py test_all.py 
Log Message:
Fixed the FSFile tests: a NameError, an incorrect filename, and an incorrect
content type.

I'm surprised these were never caught before, since these tests never could
have passed in the first place.


=== CMF/CMFCore/tests/test_FSFile.py 1.1 => 1.2 ===
--- CMF/CMFCore/tests/test_FSFile.py:1.1	Wed Aug 28 07:23:22 2002
+++ CMF/CMFCore/tests/test_FSFile.py	Thu Sep 12 11:34:03 2002
@@ -8,7 +8,7 @@
 
 from Products.CMFCore.tests.base.testcase import RequestTest, FSDVTest
 
-class FSImageTests( RequestTest, FSDVTest):
+class FSFileTests( RequestTest, FSDVTest):
 
     def setUp(self):
         FSDVTest.setUp(self)
@@ -39,11 +39,11 @@
 
         path, ref = self._extractFile()
 
-        image = self._makeOne( 'test_file', 'test_file.gif' )
-        image = image.__of__( self.root )
+        file = self._makeOne( 'test_file', 'test_file.swf' )
+        file = file.__of__( self.root )
 
-        self.assertEqual( image.get_size(), len( ref ) )
-        self.assertEqual( image._data, ref )
+        self.assertEqual( file.get_size(), len( ref ) )
+        self.assertEqual( file._readFile(0), ref )
 
     def test_index_html( self ):
 
@@ -54,10 +54,10 @@
 
         mod_time = os.stat( path )[ 8 ]
 
-        image = self._makeOne( 'test_file', 'test_file.gif' )
-        image = image.__of__( self.root )
+        file = self._makeOne( 'test_file', 'test_file.swf' )
+        file = file.__of__( self.root )
 
-        data = image.index_html( self.REQUEST, self.RESPONSE )
+        data = file.index_html( self.REQUEST, self.RESPONSE )
 
         self.assertEqual( len( data ), len( ref ) )
         self.assertEqual( data, ref )
@@ -67,7 +67,7 @@
         self.assertEqual( self.RESPONSE.getHeader( 'Content-Length'.lower() )
                         , len( ref ) )
         self.assertEqual( self.RESPONSE.getHeader( 'Content-Type'.lower() )
-                        , 'image/gif' )
+                        , 'application/octet-stream' )
         self.assertEqual( self.RESPONSE.getHeader( 'Last-Modified'.lower() )
                         , rfc1123_date( mod_time ) )
 
@@ -81,13 +81,13 @@
 
         mod_time = os.stat( path )[ 8 ]
 
-        image = self._makeOne( 'test_file', 'test_file.gif' )
-        image = image.__of__( self.root )
+        file = self._makeOne( 'test_file', 'test_file.swf' )
+        file = file.__of__( self.root )
 
         self.REQUEST.environ[ 'IF_MODIFIED_SINCE'
                             ] = '%s;' % rfc1123_date( mod_time+3600 )
 
-        data = image.index_html( self.REQUEST, self.RESPONSE )
+        data = file.index_html( self.REQUEST, self.RESPONSE )
 
         self.assertEqual( data, '' )
         self.assertEqual( self.RESPONSE.getStatus(), 304 )
@@ -102,13 +102,13 @@
 
         mod_time = os.stat( path )[ 8 ]
 
-        image = self._makeOne( 'test_image', 'test_image.gif' )
-        image = image.__of__( self.root )
+        file = self._makeOne( 'test_file', 'test_file.swf' )
+        file = file.__of__( self.root )
 
         self.REQUEST.environ[ 'IF_MODIFIED_SINCE'
                             ] = '%s;' % rfc1123_date( mod_time-3600 )
 
-        data = image.index_html( self.REQUEST, self.RESPONSE )
+        data = file.index_html( self.REQUEST, self.RESPONSE )
 
         self.failUnless( data, '' )
         self.assertEqual( self.RESPONSE.getStatus(), 200 )


=== CMF/CMFCore/tests/test_all.py 1.18 => 1.19 ===
--- CMF/CMFCore/tests/test_all.py:1.18	Tue May 14 15:59:55 2002
+++ CMF/CMFCore/tests/test_all.py	Thu Sep 12 11:34:03 2002
@@ -15,6 +15,7 @@
         'test_Expression',
         'test_CatalogTool',
         'test_DirectoryView',
+        'test_FSFile',
         'test_FSPythonScript',
         'test_FSPageTemplate',
         'test_FSImage',