[Zope3-checkins] CVS: zopeproducts/photo/ftests - __init__.py:1.1 test_photo.py:1.1

Bjorn Tillenius bjorn at codeworks.lt
Fri Aug 15 09:10:58 EDT 2003


Update of /cvs-repository/zopeproducts/photo/ftests
In directory cvs.zope.org:/tmp/cvs-serv25590/ftests

Added Files:
	__init__.py test_photo.py 
Log Message:
First checkin of the photo product.

This is intended to be similar to the photo product in Zope 2. It's not
quite finished yet, though it's already usable. Read the README for more
information.


=== Added File zopeproducts/photo/ftests/__init__.py ===
# This file is not empty


=== Added File zopeproducts/photo/ftests/test_photo.py ===
##############################################################################
#
# Copyright (c) 2003 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.
#
##############################################################################
"""Functional tests for the Photo package

$Id: test_photo.py,v 1.1 2003/08/15 12:10:51 BjornT Exp $
"""

import unittest
from transaction import get_transaction
from zope.app.content.tests.test_image import zptlogo
from zope.app.traversing import traverseName
from zope.testing.functional import FunctionalTestCase

from zopeproducts.photo import Photo


class TestPhoto(FunctionalTestCase):

    def setUp(self):
        FunctionalTestCase.setUp(self)
        rootFolder = self.getRootFolder()
        rootFolder.setObject('photo', Photo())

        get_transaction().commit()

    def tearDown(self):
        FunctionalTestCase.tearDown(self)

    def test_getImage_displayId(self):
        photo = traverseName(self.getRootFolder(), 'photo')
        photo.data = zptlogo
        self.assertEqual(zptlogo, photo.getImage('original').data)
        for displayId in photo.getDisplayIds():
            self.assertEqual(photo.getDisplaySize(displayId),
                             photo.getImage(displayId).getImageSize())

    def test_getImage_default(self):
        photo = traverseName(self.getRootFolder(), 'photo')
        photo.data = zptlogo
        self.assertEqual(zptlogo, photo.getImage('original').data)

        for displayId in photo.getDisplayIds():
            photo.currentDisplayId = displayId
            self.assertEqual(photo.getDisplaySize(displayId),
                             photo.getImage().getImageSize())
          


def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestPhoto))
    return suite


if __name__ == '__main__':
    unittest.main()




More information about the Zope3-Checkins mailing list