[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/Image/tests - testImage.py:1.1.2.3

Jim Fulton jim@zope.com
Thu, 9 May 2002 08:10:55 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/Image/tests
In directory cvs.zope.org:/tmp/cvs-serv19778

Modified Files:
      Tag: Zope-3x-branch
	testImage.py 
Log Message:
This module tested the wrong version of Image. :(

There was an attempt to move Image from OFS to OFS.Content, however,
files were copied and not moved.  

Somewhere in the copy, the rather odd semantics
of mutation changed, probably due to a change in the code that sniffs
image content. An explicit content-type passed to edit can be
overridden by a content-type deduced from sniffing the data. I think
this is broken to start with.  It looks like the image data sniffer changed.
I had to change one of the tests accordingly. 

What's especially weird is that the tests don't
actually use image data. :( The tests exercise a usage of images that
should never happen, so it's hard to tell what the test is try show.
I added an XXX comment to this effect.



=== Zope3/lib/python/Zope/App/OFS/Content/Image/tests/testImage.py 1.1.2.2 => 1.1.2.3 ===
     def _makeImage(self, *args, **kw):
         """ """
-        from Zope.App.OFS.Image.Image import Image
+        from Zope.App.OFS.Content.Image.Image import Image
 
         return Image(*args, **kw)
         
@@ -45,8 +45,13 @@
     
 
 
+        
     def testMutators(self):
 
+        # XXX What's the point of this test? Does it test that data
+        # contents override content-type? Or not? If the former, then
+        # real image data should be used.
+
         file = self._makeImage()
         
         file.setContentType('text/plain')
@@ -56,7 +61,7 @@
         self.assertEqual(file.getData(), 'Foobar')
 
         file.edit('Blah', 'text/html')
-        self.assertEqual(file.getContentType(), 'text/plain')
+        self.assertEqual(file.getContentType(), 'text/html')
         self.assertEqual(file.getData(), 'Blah')