[CMF-checkins] CVS: CMF/CMFCalendar/tests -
test_Calendar.py:1.4.22.1 test_Event.py:1.5.22.1
Sidnei da Silva
sidnei at awkly.org
Thu Apr 22 13:48:15 EDT 2004
Update of /cvs-repository/CMF/CMFCalendar/tests
In directory cvs.zope.org:/tmp/cvs-serv30596/CMFCalendar/tests
Modified Files:
Tag: CMF-1_4-branch
test_Calendar.py test_Event.py
Log Message:
Fix version.txt to right version. Run reindent.py for removing extra tabs and whitespaces
=== CMF/CMFCalendar/tests/test_Calendar.py 1.4 => 1.4.22.1 ===
--- CMF/CMFCalendar/tests/test_Calendar.py:1.4 Sun Jul 21 19:38:36 2002
+++ CMF/CMFCalendar/tests/test_Calendar.py Thu Apr 22 13:47:44 2004
@@ -11,7 +11,7 @@
def setUp(self):
get_transaction().begin()
-
+
self.app = makerequest(Zope.app())
# Log in as a god :-)
newSecurityManager(None, UnrestrictedUser('god',
@@ -25,7 +25,7 @@
try: app._delObject('CalendarTest')
except AttributeError: pass
app.manage_addProduct['CMFDefault'].manage_addCMFSite('CalendarTest')
-
+
self.Site = app.CalendarTest
manage_addExternalMethod(app.CalendarTest,
@@ -33,10 +33,10 @@
title="Install Events",
module="CMFCalendar.Install",
function="install")
-
+
ExMethod = app.restrictedTraverse('/CalendarTest/install_events')
ExMethod()
-
+
self.Tool = app.restrictedTraverse('/CalendarTest/portal_calendar')
# sessioning bodge until we find out how to do this properly
@@ -45,32 +45,32 @@
if self.have_session:
app.REQUEST.set_lazy( 'SESSION'
, app.session_data_manager.getSessionData )
-
+
# bodge us a URL1
-
+
def _testURL(self,url,params=None):
Site = self.Site
obj = Site.restrictedTraverse(url)
if params is None:
params=(obj, Site.REQUEST)
apply(obj,params)
-
+
def tearDown(self):
get_transaction().abort()
self.app._p_jar.close()
-
-
+
+
def test_new(self):
tool = CalendarTool.CalendarTool()
self.assertEqual(tool.getId(),'portal_calendar')
-
+
def test_types(self):
self.assertEqual(self.Tool.getCalendarTypes(),['Event'])
self.Tool.edit_configuration(show_types=['Event','Party']
, use_session="")
self.assertEqual(self.Tool.getCalendarTypes(),['Event', 'Party'])
-
+
def test_Days(self):
assert self.Tool.getDays() == ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
@@ -80,16 +80,16 @@
return
self.Tool.edit_configuration(show_types=['Event'], use_session="True")
-
+
self._testURL('/CalendarTest/calendarBox', ())
-
+
self.failUnless(self.app.REQUEST.SESSION.get('calendar_year',None))
def XXX_test_noSessions(self):
self.Tool.edit_configuration(show_types=['Event'], use_session="")
-
+
self._testURL('/CalendarTest/calendarBox', ())
-
+
if self.have_session:
self.failIf(self.app.REQUEST.SESSION.get('calendar_year',None))
@@ -139,12 +139,12 @@
{'day':31, 'event': 0, 'eventslist':[]},
{'day': 0, 'event': 0, 'eventslist':[]},
{'day': 0, 'event': 0, 'eventslist':[]}
- ]
+ ]
]
assert self.Tool.getEventsForCalendar(month='1', year='2002') == data, self.Tool.getEventsForCalendar(month='1', year='2002')
-
+
def test_singleEventCalendarRendering(self):
-
+
self.Site.Members.folder_factories.invokeFactory(type_name="Event",id='Event1')
event = self.app.restrictedTraverse('/CalendarTest/Members/Event1')
event.edit( title='title'
@@ -164,8 +164,8 @@
self.Site.portal_workflow.doActionFor(
event,
'publish',
- comment='testing')
-
+ comment='testing')
+
data = [
[
{'day': 0, 'event': 0, 'eventslist':[]},
@@ -211,12 +211,12 @@
{'day':31, 'event': 0, 'eventslist':[]},
{'day': 0, 'event': 0, 'eventslist':[]},
{'day': 0, 'event': 0, 'eventslist':[]}
- ]
+ ]
]
assert self.Tool.getEventsForCalendar(month='1', year='2002') == data, self.Tool.getEventsForCalendar(month='1', year='2002')
def test_spanningEventCalendarRendering(self):
-
+
self.Site.Members.folder_factories.invokeFactory(type_name="Event",id='Event1')
event = self.app.restrictedTraverse('/CalendarTest/Members/Event1')
event.edit( title='title'
@@ -236,8 +236,8 @@
self.Site.portal_workflow.doActionFor(
event,
'publish',
- comment='testing')
-
+ comment='testing')
+
data = [
[
{'day': 0, 'event': 0, 'eventslist':[]},
@@ -283,14 +283,14 @@
{'day':31, 'event': 1, 'eventslist':[{'title': 'title', 'end': '23:59:00', 'start': None}]},
{'day': 0, 'event': 0, 'eventslist':[]},
{'day': 0, 'event': 0, 'eventslist':[]}
- ]
+ ]
]
assert self.Tool.getEventsForCalendar(month='1', year='2002') == data, self.Tool.getEventsForCalendar(month='1', year='2002')
def test_getPreviousMonth(self):
assert self.Tool.getPreviousMonth(2,2002) == DateTime('1/1/2002')
assert self.Tool.getPreviousMonth(1,2002) == DateTime('12/1/2001')
-
+
def test_getNextMonth(self):
assert self.Tool.getNextMonth(12,2001) == DateTime('1/1/2002')
assert self.Tool.getNextMonth(1,2002) == DateTime('2/1/2002')
@@ -299,7 +299,7 @@
assert self.Tool.getBeginAndEndTimes(1,12,2001) == (DateTime('12/1/2001 12:00:00AM'),DateTime('12/1/2001 11:59:59PM'))
def test_singleDayRendering(self):
-
+
self.Site.Members.folder_factories.invokeFactory(type_name="Event",id='Event1')
event = self.app.restrictedTraverse('/CalendarTest/Members/Event1')
event.edit( title='title'
@@ -319,8 +319,8 @@
self.Site.portal_workflow.doActionFor(
event,
'publish',
- comment='testing')
-
+ comment='testing')
+
assert len(self.Site.portal_calendar.getEventsForThisDay(thisDay=DateTime('1/1/2002'))) == 1
self.Site.Members.folder_factories.invokeFactory(type_name="Event",id='Event2')
@@ -342,10 +342,10 @@
self.Site.portal_workflow.doActionFor(
event,
'publish',
- comment='testing')
+ comment='testing')
assert len(self.Site.portal_calendar.getEventsForThisDay(thisDay=DateTime('1/1/2002'))) == 2
-
+
self.Site.Members.folder_factories.invokeFactory(type_name="Event",id='Event3')
event = self.app.restrictedTraverse('/CalendarTest/Members/Event3')
event.edit( title='title'
@@ -365,7 +365,7 @@
self.Site.portal_workflow.doActionFor(
event,
'publish',
- comment='testing')
+ comment='testing')
assert len(self.Site.portal_calendar.getEventsForThisDay(thisDay=DateTime('1/1/2002'))) == 3
@@ -388,7 +388,7 @@
self.Site.portal_workflow.doActionFor(
event,
'publish',
- comment='testing')
+ comment='testing')
assert len(self.Site.portal_calendar.getEventsForThisDay(thisDay=DateTime('1/1/2002'))) == 4
@@ -411,7 +411,7 @@
self.Site.portal_workflow.doActionFor(
event,
'publish',
- comment='testing')
+ comment='testing')
assert len(self.Site.portal_calendar.getEventsForThisDay(thisDay=DateTime('1/1/2002'))) == 4
=== CMF/CMFCalendar/tests/test_Event.py 1.5 => 1.5.22.1 ===
--- CMF/CMFCalendar/tests/test_Event.py:1.5 Mon Jul 8 09:46:53 2002
+++ CMF/CMFCalendar/tests/test_Event.py Thu Apr 22 13:47:44 2004
@@ -9,7 +9,7 @@
event = Event('test')
assert event.getId() == 'test'
assert not event.Title()
-
+
def test_edit(self):
event = Event('editing')
event.edit( title='title'
@@ -29,8 +29,8 @@
assert event.Title() == 'title'
assert event.Description() == 'description'
assert event.Subject() == ( 'eventType', ), event.Subject()
- assert event.effective_date == None
- assert event.expiration_date == None
+ assert event.effective_date == None
+ assert event.expiration_date == None
assert event.end() == DateTime('1999/12/31 23:59')
assert event.start() == DateTime('1999/01/01 00:00')
assert not event.contact_name
More information about the CMF-checkins
mailing list