[CMF-checkins] CVS: CMF - test_Event.py:1.1

andrew@digicool.com andrew@digicool.com
Wed, 30 May 2001 18:08:40 -0400 (EDT)


Update of /cvs-repository/CMF/CMFCalendar/tests
In directory korak.digicool.com:/tmp/cvs-serv16384/tests

Added Files:
	test_Event.py 
Log Message:

*CMFCalendar product (Events) 0.1a



--- Added File test_Event.py in package CMF ---
import ZServer
import Zope
import unittest, string
from Products.CMFCalendar.Event import *
from DateTime import DateTime

class TestEvent(unittest.TestCase):
    def test_new(self):
        event = Event('test')
        assert event.getId() == 'test'
        assert not event.Title()
    
    def test_edit(self):
        event = Event('editing')
        #import pdb; pdb.set_trace()
        event.edit( title='title'
                  , description='description'
                  , eventType=( 'eventType', )
                  , effectiveDay=1
                  , effectiveMo=1
                  , effectiveYear=1999
                  , expirationDay=12
                  , expirationMo=31
                  , expirationYear=1999
                  , start_time="00:00"
                  , startAMPM="AM"
                  , stop_time="11:59"
                  , stopAMPM="PM"
                  )
        assert event.Title() == 'title'
        assert event.Description() == 'description'
        assert event.Subject() == ( 'eventType', ), event.Subject()
        assert event.effective() == DateTime('1999/01/01 00:00')
        assert event.expires() == DateTime('1999/12/31 23:59')
        assert not event.contact_name

    def test_puke(self):
        event = Event( 'shouldPuke' )
        self.assertRaises( DateTime.DateError
                         , event.edit
                         , effectiveDay=31
                         , effectiveMo=2
                         , effectiveYear=1999
                         , start_time="00:00"
                         , startAMPM="AM"
                         )

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

def run():
    unittest.TextTestRunner().run(test_suite())

if __name__ == '__main__':
    run()