[Zope3-checkins] CVS: zopeproducts/photoslide/tests - __init__.py:1.1 test_photoslide.py:1.1 test_photoslides.py:1.1

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


Update of /cvs-repository/zopeproducts/photoslide/tests
In directory cvs.zope.org:/tmp/cvs-serv26803/tests

Added Files:
	__init__.py test_photoslide.py test_photoslides.py 
Log Message:
First checkin of the photoslide product.

This product produces a slide show of photos. It works, although the
views aren't that nice yet. 


=== Added File zopeproducts/photoslide/tests/__init__.py ===


=== Added File zopeproducts/photoslide/tests/test_photoslide.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.
#
##############################################################################
"""Tests for the PhotoSlide class

$Id: test_photoslide.py,v 1.1 2003/08/15 12:15:22 BjornT Exp $
"""

import unittest

from zope.app.container.tests.test_icontainer import BaseTestIContainer
from zope.app.container.tests.test_icontainer import DefaultTestData
from zope.app.content.tests.test_image import zptlogo
from zope.app.content.image import Image
from zope.interface.verify import verifyObject
from zope.app import zapi

small_image = Image(zptlogo)

class TestPhotoSlide(BaseTestIContainer, unittest.TestCase):

    def makeTestObject(self):
        from zopeproducts.photoslide import PhotoSlide
        return PhotoSlide()

    def getUnknownKey(self):
        return 'm'
    
    def getBadKeyTypes(self):
        return [None, ['foo'], 1, '\xf3abc']

    def makeTestData(self):
        return DefaultTestData()

    def test_interface(self):
        from zopeproducts.photoslide.interfaces import IPhotoSlide
        from zopeproducts.photoslide import PhotoSlide

        verifyObject(IPhotoSlide, PhotoSlide())

    def test_title(self):
        from zopeproducts.photoslide import PhotoSlide

        photoslide = PhotoSlide()
        self.assertEqual(u'', photoslide.title)
        photoslide.title = u'A Title'
        self.assertEqual(u'A Title', photoslide.title)

    def test_description(self):
        from zopeproducts.photoslide import PhotoSlide

        photoslide = PhotoSlide()
        self.assertEqual(u'', photoslide.description)
        photoslide.description = u'A Description'
        self.assertEqual(u'A Description', photoslide.description)

    def test_positions(self):
        from zopeproducts.photoslide import PhotoSlide
        from zopeproducts.photo import Photo

        photoSlide = PhotoSlide()
        aPhoto = Photo()
        anotherPhoto = Photo()
        yetAnotherPhoto = Photo()
        photoSlide.setObject('a', aPhoto)
        photoSlide.setObject('b', anotherPhoto)
        photoSlide.setObject('c', yetAnotherPhoto)
        self.assertEqual(photoSlide.getPosition('a'), 1)
        self.assertEqual(photoSlide.getPosition('b'), 2)
        self.assertEqual(photoSlide.getPosition('c'), 3)
        self.assertEqual(photoSlide.getPhotos()[0], aPhoto)
        self.assertEqual(photoSlide.getPhotos()[1], anotherPhoto)
        self.assertEqual(photoSlide.getPhotos()[2], yetAnotherPhoto)
        self.assertEqual(photoSlide.getPhotoNames()[0], 'a')
        self.assertEqual(photoSlide.getPhotoNames()[1], 'b')
        self.assertEqual(photoSlide.getPhotoNames()[2], 'c')

        photoSlide.setPosition('a', 3)
        self.assertEqual(photoSlide.getPosition('a'), 3)
        self.assertEqual(photoSlide.getPosition('b'), 1)
        self.assertEqual(photoSlide.getPosition('c'), 2)
        self.assertEqual(photoSlide.getPhotos()[2], aPhoto)
        self.assertEqual(photoSlide.getPhotos()[0], anotherPhoto)
        self.assertEqual(photoSlide.getPhotos()[1], yetAnotherPhoto)
        self.assertEqual(photoSlide.getPhotoNames()[2], 'a')
        self.assertEqual(photoSlide.getPhotoNames()[0], 'b')
        self.assertEqual(photoSlide.getPhotoNames()[1], 'c')

        photoSlide.setPosition('a', 2)
        self.assertEqual(photoSlide.getPosition('a'), 2)
        self.assertEqual(photoSlide.getPosition('b'), 1)
        self.assertEqual(photoSlide.getPosition('c'), 3)
        self.assertEqual(photoSlide.getPhotos()[1], aPhoto)
        self.assertEqual(photoSlide.getPhotos()[0], anotherPhoto)
        self.assertEqual(photoSlide.getPhotos()[2], yetAnotherPhoto)
        self.assertEqual(photoSlide.getPhotoNames()[1], 'a')
        self.assertEqual(photoSlide.getPhotoNames()[0], 'b')
        self.assertEqual(photoSlide.getPhotoNames()[2], 'c')



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


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


=== Added File zopeproducts/photoslide/tests/test_photoslides.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.
#
##############################################################################
"""Tests for the PhotoSlideFolder class

$Id: test_photoslides.py,v 1.1 2003/08/15 12:15:22 BjornT Exp $
"""

import unittest

from zope.app.container.tests.test_icontainer import BaseTestIContainer
from zope.app.container.tests.test_icontainer import DefaultTestData
from zope.app.content.tests.test_image import zptlogo
from zope.app.content.image import Image
from zope.interface.verify import verifyObject
from zope.app import zapi

small_image = Image(zptlogo)

class TestPhotoSlideFolder(BaseTestIContainer, unittest.TestCase):

    def makeTestObject(self):
        from zopeproducts.photoslide import PhotoSlideFolder
        return PhotoSlideFolder()

    def getUnknownKey(self):
        return 'm'

    def getBadKeyTypes(self):
        return [None, ['foo'], 1, '\xf3abc']

    def makeTestData(self):
        return DefaultTestData()

    def test_interface(self):
        from zopeproducts.photoslide.interfaces import IPhotoSlideFolder
        from zopeproducts.photoslide import PhotoSlideFolder

        verifyObject(IPhotoSlideFolder, PhotoSlideFolder())



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


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




More information about the Zope3-Checkins mailing list