[CMF-checkins] CVS: Products/CMFDefault/tests - test_Image.py:1.7
Stefan H. Holek
stefan at epy.co.at
Sat Jul 31 10:29:57 EDT 2004
Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv29847/CMFDefault/tests
Modified Files:
test_Image.py
Log Message:
setFormat() failed to update the content_type property causing index_html() to use
a stale mimetype when serving the file or image.
Also see http://collector.zope.org/CMF/226
=== Products/CMFDefault/tests/test_Image.py 1.6 => 1.7 ===
--- Products/CMFDefault/tests/test_Image.py:1.6 Mon Apr 26 08:14:18 2004
+++ Products/CMFDefault/tests/test_Image.py Sat Jul 31 10:29:52 2004
@@ -9,6 +9,7 @@
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
from Products.CMFDefault import tests
+from Products.CMFDefault.File import File
from Products.CMFDefault.Image import Image
TESTS_HOME = tests.__path__[0]
@@ -39,6 +40,24 @@
assert image.get_size() > 0
assert image.get_size() == testfilesize
+ def test_File_setFormat(self):
+ """ Setting the DC.format must also set the content_type property """
+ file = File('testfile', format='image/jpeg')
+ self.assertEqual(file.Format(), 'image/jpeg')
+ self.assertEqual(file.content_type, 'image/jpeg')
+ file.setFormat('image/gif')
+ self.assertEqual(file.Format(), 'image/gif')
+ self.assertEqual(file.content_type, 'image/gif')
+
+ def test_Image_setFormat(self):
+ """ Setting the DC.format must also set the content_type property """
+ image = Image('testimage', format='image/jpeg')
+ self.assertEqual(image.Format(), 'image/jpeg')
+ self.assertEqual(image.content_type, 'image/jpeg')
+ image.setFormat('image/gif')
+ self.assertEqual(image.Format(), 'image/gif')
+ self.assertEqual(image.content_type, 'image/gif')
+
def test_suite():
return TestSuite((
More information about the CMF-checkins
mailing list