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

Stephan Richter srichter@cbu.edu
Wed, 27 Mar 2002 10:54:41 -0500


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

Added Files:
      Tag: Zope-3x-branch
	__init__.py testImage.py 
Log Message:
New Content Objects:

- NaiveFile --> all the data is stored in one string
- File --> Uses a BTree to store the data in chunks (more efficient)
- Image --> Can store and display an image a la Z2 (based on File)
- ZPTPage --> A simple version of ZPT for the content space to allow some 
  dynamics data (please do not use this for scripting)

Also:

- Expansion of supported views
- all edit screens are Formulator supported



=== Added File Zope3/lib/python/Zope/App/OFS/Content/Image/tests/__init__.py ===
##############################################################################
#
# 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: __init__.py,v 1.1.2.1 2002/03/27 15:54:40 srichter Exp $
"""


=== Added File Zope3/lib/python/Zope/App/OFS/Content/Image/tests/testImage.py ===
##############################################################################
#
# 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: testImage.py,v 1.1.2.1 2002/03/27 15:54:40 srichter Exp $
"""

import unittest
from Interface.Verify import verifyClass

class Test( unittest.TestCase ):


    def _makeImage(self, *args, **kw):
        """ """
        from Zope.App.OFS.Image.Image import Image

        return Image(*args, **kw)
        

    def testEmpty( self ):

        file = self._makeImage()

        self.assertEqual(file.getContentType(), '')
        self.assertEqual(file.getData(), None)


    def testConstructor(self):

        file = self._makeImage('Data')
        self.assertEqual(file.getContentType(), '')
        self.assertEqual(file.getData(), 'Data')
    


    def testMutators(self):

        file = self._makeImage()
        
        file.setContentType('text/plain')
        self.assertEqual(file.getContentType(), 'text/plain')

        file.setData('Foobar')
        self.assertEqual(file.getData(), 'Foobar')

        file.edit('Blah', 'text/html')
        self.assertEqual(file.getContentType(), 'text/plain')
        self.assertEqual(file.getData(), 'Blah')


    def testInterface(self):
        
        from Zope.App.OFS.Content.Image.Image import Image, IImage

        self.failUnless(IImage.isImplementedByInstancesOf(Image))
        self.failUnless(verifyClass(IImage, Image))        
        


def test_suite():
    loader = unittest.TestLoader()
    return loader.loadTestsFromTestCase( Test )

if __name__=='__main__':
    unittest.TextTestRunner().run( test_suite() )