[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser/tests - __init__.py:1.2 testImageData.py:1.2 testImageEdit.py:1.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 19:28:35 -0400


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

Added Files:
	__init__.py testImageData.py testImageEdit.py 
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.


=== Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser/tests/__init__.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
+"""
+
+$Id$
+"""


=== Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser/tests/testImageData.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+import unittest
+
+from Zope.App.OFS.Content.Image.Views.Browser.ImageData import ImageData
+from Zope.App.OFS.Content.Image.Image import Image
+
+
+class Test( unittest.TestCase ):
+
+    def testData(self):
+        """ """
+        image = Image('Data')
+
+        id = ImageData(image, None) 
+
+        self.assertEqual(id(), 'Data')
+
+
+    def testTag(self):
+        """ """
+
+        # We need that, sinc eabsolute_url is not implemented yet.
+        def absolute_url():
+            return '/img'
+            
+        image = Image()        
+        fe = ImageData(image, None)
+        fe.absolute_url = absolute_url
+
+        self.assertEqual(fe.tag(),
+            '<img src="/img" alt="" height="-1" width="-1" border="0" />')
+        self.assertEqual(fe.tag(alt="Test Image"),
+            '<img src="/img" alt="Test Image" '
+            'height="-1" width="-1" border="0" />')
+        self.assertEqual(fe.tag(height=100, width=100),
+            '<img src="/img" alt="" height="100" width="100" border="0" />')
+        self.assertEqual(fe.tag(border=1),
+            '<img src="/img" alt="" height="-1" width="-1" border="1" />')
+        self.assertEqual(fe.tag(css_class="Image"),
+            '<img src="/img" alt="" '
+            'height="-1" width="-1" border="0" class="Image" />')
+        self.assertEqual(fe.tag(height=100, width="100",
+                         border=1, css_class="Image"),
+            '<img src="/img" alt="" '
+            'height="100" width="100" class="Image" border="1" />')
+
+
+def test_suite():
+    loader = unittest.TestLoader()
+    return loader.loadTestsFromTestCase( Test )
+
+if __name__=='__main__':
+    unittest.main()


=== Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser/tests/testImageEdit.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+import unittest, cStringIO
+
+from Zope.App.OFS.Content.Image.Views.Browser.ImageEdit import ImageEdit
+from Zope.App.OFS.Content.Image.Image import Image
+
+
+class Test( unittest.TestCase ):
+
+    def testEdit(self):
+        """ """
+        file = Image()
+        fe = ImageEdit(file, None) 
+
+        file = cStringIO.StringIO()
+        file.write('Data')
+        file.seek(0)
+
+        # XXX How can I create a REQUEST object?
+        #fe.action({'field_data': file, 'field_contentType': 'text/plain'})
+        #self.assertEqual(fe.context.getContentType(), 'text/plain')
+        #self.assertEqual(fe.context.getData(), 'Data')
+        
+
+
+def test_suite():
+    loader = unittest.TestLoader()
+    return loader.loadTestsFromTestCase( Test )
+
+if __name__=='__main__':
+    unittest.main()