[Zope-CVS] CVS: Products/AdaptableStorage/tests - testZope2FS.py:1.19

Shane Hathaway shane@zope.com
Thu, 6 Feb 2003 13:14:14 -0500


Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv18094/tests

Modified Files:
	testZope2FS.py 
Log Message:
Corrected the automatic extension for certain kinds of files.

=== Products/AdaptableStorage/tests/testZope2FS.py 1.18 => 1.19 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.18	Thu Feb  6 12:55:26 2003
+++ Products/AdaptableStorage/tests/testZope2FS.py	Thu Feb  6 13:14:13 2003
@@ -26,6 +26,7 @@
 from ZODB.POSException import ConflictError
 from Products.PythonScripts.PythonScript import PythonScript
 from OFS.Image import manage_addImage
+from OFS.Image import manage_addFile
 from Products.AdaptableStorage.zodb.ASDB import ASDB
 from Products.AdaptableStorage.zodb.ASStorage import ASStorage
 from Products.AdaptableStorage.zodb.StaticResource import StaticResource
@@ -403,6 +404,28 @@
             names = os.listdir(dir)
             self.assert_(('image.png') in names, names)
             self.assert_(('image') not in names, names)
+        finally:
+            conn.close()
+
+
+    def testCorrectedFileExtension(self):
+        # Verify that certain content_types use the correct filename
+        # extension.
+        data = 'Hello, world!'
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            manage_addFile(app, 'hello', StringIO(data),
+                           content_type='text/plain')
+            manage_addFile(app, 'binary_file', StringIO(data),
+                           content_type='application/octet-stream')
+            get_transaction().commit()
+
+            dir = self.conn.expandPath('/')
+            names = os.listdir(dir)
+            self.assert_(('hello.txt') in names, names)
+            self.assert_(('hello') not in names, names)
+            self.assert_(('binary_file') in names, names)
         finally:
             conn.close()