Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
CMFCalendar.tests.test_Calendar.CalendarRequestTests Class Reference

List of all members.

Public Member Functions

def afterSetUp
def test_sessions_skinsview
def test_sessions_fiveview
def test_noSessions_skinsview
def test_noSessions_fiveview
def test_simpleCalendarRendering
def test_singleEventCalendarRendering
def test_eventCalendarRenderingIssue411
def test_spanningEventCalendarRendering
def test_getPreviousMonth
def test_getNextMonth
def test_getBeginAndEndTimes
def test_singleDayRendering
def test_lastDayRendering
def test_firstDayRendering
def test_workflowStateRendering
def test_EventEndingMidnight

Static Public Attributes

 layer = FunctionalLayer

Private Member Functions

def _testURL

Detailed Description

Definition at line 106 of file test_Calendar.py.


Member Function Documentation

def CMFCalendar.tests.test_Calendar.CalendarRequestTests._testURL (   self,
  url,
  params = None 
) [private]

Definition at line 119 of file test_Calendar.py.

00119 
00120     def _testURL(self, url, params=None):
00121         obj = self.app.site.restrictedTraverse(url)
00122         if params is None:
00123             params=(obj, self.app.site.REQUEST)
00124         obj(*params)

Here is the caller graph for this function:

Definition at line 110 of file test_Calendar.py.

00110 
00111     def afterSetUp(self):
00112         setSite(self.app.site)
00113         self.app.site.setupCurrentSkin(self.app.REQUEST)
00114         newSecurityManager(None, UnrestrictedUser('god', '', ['Manager'], ''))
00115 
00116         # sessioning setup
00117         sdm = self.app.session_data_manager
00118         self.app.REQUEST.set_lazy('SESSION', sdm.getSessionData)

Definition at line 278 of file test_Calendar.py.

00278 
00279     def test_eventCalendarRenderingIssue411(self):
00280         #  http://www.zope.org/Collectors/CMF/411
00281         site = self.app.site
00282         site.Members.invokeFactory(type_name="Event",id='Event1')
00283         event = self.app.restrictedTraverse('/site/Members/Event1')
00284         event.edit( title='title'
00285                     , description='description'
00286                     , eventType=( 'eventType', )
00287                     , effectiveDay=31
00288                     , effectiveMo=3
00289                     , effectiveYear=2006
00290                     , expirationDay=1
00291                     , expirationMo=4
00292                     , expirationYear=2006
00293                     , start_time="00:00"
00294                     , startAMPM="AM"
00295                     , stop_time="00:00"
00296                     , stopAMPM="AM"
00297                     )
00298         site.portal_workflow.doActionFor(event, 'publish', comment='testing')
00299 
00300         site.Members.invokeFactory(type_name="Event",id='Event2')
00301         event = self.app.restrictedTraverse('/site/Members/Event2')
00302         event.edit( title='title'
00303                     , description='description'
00304                     , eventType=( 'eventType', )
00305                     , effectiveDay=29
00306                     , effectiveMo=3
00307                     , effectiveYear=2006
00308                     , expirationDay=30
00309                     , expirationMo=3
00310                     , expirationYear=2006
00311                     , start_time="00:00"
00312                     , startAMPM="AM"
00313                     , stop_time="00:00"
00314                     , stopAMPM="AM"
00315                     )
00316         site.portal_workflow.doActionFor(event, 'publish', comment='testing')
00317 
00318         # With the bug unfixed, this raises a TypeError
00319         ignored = site.portal_calendar.catalog_getevents(2006, 3)

Definition at line 684 of file test_Calendar.py.

00684 
00685     def test_EventEndingMidnight(self):
00686         # Events ending exactly at midnight should not be shown for the day
00687         # after (see http://www.zope.org/Collectors/CMF/246)
00688         site = self.app.site
00689         caltool = self.app.site.portal_calendar
00690         the_day = DateTime('2002/05/01')
00691         day_after = DateTime('2002/05/02')
00692 
00693         site.invokeFactory('Event', id='party',
00694                            start_date=the_day,
00695                            end_date=day_after)
00696         site.portal_workflow.doActionFor(site.party, 'publish')
00697 
00698         # One entry should be present for the day of the event
00699         self.assertEqual(len(caltool.getEventsForThisDay(the_day)), 1)
00700 
00701         # No entry should be present for the day after
00702         self.assertEqual(len(caltool.getEventsForThisDay(day_after)), 0)
00703 
00704         # First week of May 2002
00705         data = [
00706                {'day': 1, 'event': 1, 'eventslist':[{'start': '00:00:00',
00707                                                      'end': '23:59:59',
00708                                                      'title': 'party'}]},
00709                {'day': 2, 'event': 0, 'eventslist':[]},
00710                {'day': 3, 'event': 0, 'eventslist':[]},
00711                {'day': 4, 'event': 0, 'eventslist':[]},
00712                {'day': 5, 'event': 0, 'eventslist':[]},
00713                {'day': 6, 'event': 0, 'eventslist':[]},
00714                {'day': 7, 'event': 0, 'eventslist':[]},
00715                ]
00716 
00717         events = caltool.catalog_getevents(2002, 5)
00718         self.assertEqual([events[e] for e in range(1, 8)], data)
00719 

Definition at line 614 of file test_Calendar.py.

00614 
00615     def test_firstDayRendering(self):
00616         # Double check it works on the other boundary as well
00617         site = self.app.site
00618         site.invokeFactory('Event', id='yesterday', title='yesterday',
00619                            start_date='2002/05/31 23:50:00',
00620                            end_date='2002/05/31 23:59:59')
00621 
00622         site.invokeFactory('Event', id='today', title='today',
00623                            start_date='2002/06/01 00:00:00',
00624                            end_date='2002/06/01 00:10:00')
00625 
00626         site.portal_workflow.doActionFor(site.yesterday, 'publish')
00627         site.portal_workflow.doActionFor(site.today, 'publish')
00628 
00629         # First week of June 2002
00630         data = [
00631                {'day': 1, 'event': 1, 'eventslist':[{'start': '00:00:00',
00632                                                      'end': '00:10:00',
00633                                                      'title': 'today'}]},
00634                {'day': 2, 'event': 0, 'eventslist':[]},
00635                {'day': 3, 'event': 0, 'eventslist':[]},
00636                {'day': 4, 'event': 0, 'eventslist':[]},
00637                {'day': 5, 'event': 0, 'eventslist':[]},
00638                {'day': 6, 'event': 0, 'eventslist':[]},
00639                {'day': 7, 'event': 0, 'eventslist':[]},
00640                ]
00641 
00642         events = site.portal_calendar.catalog_getevents(2002, 6)
00643         self.assertEqual([events[e] for e in range(1, 8)], data)

Definition at line 469 of file test_Calendar.py.

00469 
00470     def test_getBeginAndEndTimes(self):
00471         caltool = self.app.site.portal_calendar
00472 
00473         self.assertEqual( caltool.getBeginAndEndTimes(1,12,2001),
00474                           ( DateTime('2001/12/1 12:00:00AM'),
00475                             DateTime('2001/12/1 11:59:59PM') ) )

Definition at line 461 of file test_Calendar.py.

00461 
00462     def test_getNextMonth(self):
00463         caltool = self.app.site.portal_calendar
00464 
00465         self.assertEqual( caltool.getNextMonth(12,2001),
00466                           DateTime('2002/1/1') )
00467         self.assertEqual( caltool.getNextMonth(1,2002),
00468                           DateTime('2002/2/1') )

Definition at line 453 of file test_Calendar.py.

00453 
00454     def test_getPreviousMonth(self):
00455         caltool = self.app.site.portal_calendar
00456 
00457         self.assertEqual( caltool.getPreviousMonth(2,2002),
00458                           DateTime('2002/1/1') )
00459         self.assertEqual( caltool.getPreviousMonth(1,2002),
00460                           DateTime('2001/12/1') )

Definition at line 583 of file test_Calendar.py.

00583 
00584     def test_lastDayRendering(self):
00585         # Bug in catalog_getevents included events starting at 00:00:00
00586         # on the next day
00587         site = self.app.site
00588         site.invokeFactory('Event', id='today', title='today',
00589                            start_date='2002/05/31 23:50:00',
00590                            end_date='2002/05/31 23:59:59')
00591 
00592         site.invokeFactory('Event', id='tomorrow', title='tomorrow',
00593                            start_date='2002/06/01 00:00:00',
00594                            end_date='2002/06/01 00:10:00')
00595 
00596         site.portal_workflow.doActionFor(site.today, 'publish')
00597         site.portal_workflow.doActionFor(site.tomorrow, 'publish')
00598 
00599         # Last week of May 2002
00600         data = [
00601                {'day': 25, 'event': 0, 'eventslist':[]},
00602                {'day': 26, 'event': 0, 'eventslist':[]},
00603                {'day': 27, 'event': 0, 'eventslist':[]},
00604                {'day': 28, 'event': 0, 'eventslist':[]},
00605                {'day': 29, 'event': 0, 'eventslist':[]},
00606                {'day': 30, 'event': 0, 'eventslist':[]},
00607                {'day': 31, 'event': 1, 'eventslist':[{'start': '23:50:00',
00608                                                       'end': '23:59:59',
00609                                                       'title': 'today'}]},
00610                ]
00611 
00612         events = site.portal_calendar.catalog_getevents(2002, 5)
00613         self.assertEqual([events[e] for e in range(25, 32)], data)

Definition at line 146 of file test_Calendar.py.

00146 
00147     def test_noSessions_fiveview(self):
00148         caltool = self.app.site.portal_calendar
00149         caltool.edit_configuration(show_types=['Event'], use_session="")
00150         self._testURL('/site/@@calendar_widget', ())
00151 
00152         self.failIf(self.app.REQUEST.SESSION.get('calendar_year',None))

Here is the call graph for this function:

Definition at line 139 of file test_Calendar.py.

00139 
00140     def test_noSessions_skinsview(self):
00141         caltool = self.app.site.portal_calendar
00142         caltool.edit_configuration(show_types=['Event'], use_session="")
00143         self._testURL('/site/calendarBox', ())
00144 
00145         self.failIf(self.app.REQUEST.SESSION.get('calendar_year',None))

Here is the call graph for this function:

Definition at line 132 of file test_Calendar.py.

00132 
00133     def test_sessions_fiveview(self):
00134         caltool = self.app.site.portal_calendar
00135         caltool.edit_configuration(show_types=['Event'], use_session="True")
00136         self._testURL('/site/@@calendar_widget', ())
00137 
00138         self.failUnless(self.app.REQUEST.SESSION.get('calendar_year',None))

Here is the call graph for this function:

Definition at line 125 of file test_Calendar.py.

00125 
00126     def test_sessions_skinsview(self):
00127         caltool = self.app.site.portal_calendar
00128         caltool.edit_configuration(show_types=['Event'], use_session="True")
00129         self._testURL('/site/calendarBox', ())
00130 
00131         self.failUnless(self.app.REQUEST.SESSION.get('calendar_year',None))

Here is the call graph for this function:

Definition at line 153 of file test_Calendar.py.

00153 
00154     def test_simpleCalendarRendering(self):
00155         caltool = self.app.site.portal_calendar
00156         data = [
00157                 [
00158                  {'day': 0, 'event': 0, 'eventslist':[]},
00159                  {'day': 0, 'event': 0, 'eventslist':[]},
00160                  {'day': 0, 'event': 0, 'eventslist':[]},
00161                  {'day': 1, 'event': 0, 'eventslist':[]},
00162                  {'day': 2, 'event': 0, 'eventslist':[]},
00163                  {'day': 3, 'event': 0, 'eventslist':[]},
00164                  {'day': 4, 'event': 0, 'eventslist':[]},
00165                  ],
00166                 [
00167                  {'day': 5, 'event': 0, 'eventslist':[]},
00168                  {'day': 6, 'event': 0, 'eventslist':[]},
00169                  {'day': 7, 'event': 0, 'eventslist':[]},
00170                  {'day': 8, 'event': 0, 'eventslist':[]},
00171                  {'day': 9, 'event': 0, 'eventslist':[]},
00172                  {'day':10, 'event': 0, 'eventslist':[]},
00173                  {'day':11, 'event': 0, 'eventslist':[]},
00174                  ],
00175                 [
00176                  {'day':12, 'event': 0, 'eventslist':[]},
00177                  {'day':13, 'event': 0, 'eventslist':[]},
00178                  {'day':14, 'event': 0, 'eventslist':[]},
00179                  {'day':15, 'event': 0, 'eventslist':[]},
00180                  {'day':16, 'event': 0, 'eventslist':[]},
00181                  {'day':17, 'event': 0, 'eventslist':[]},
00182                  {'day':18, 'event': 0, 'eventslist':[]},
00183                  ],
00184                 [
00185                  {'day':19, 'event': 0, 'eventslist':[]},
00186                  {'day':20, 'event': 0, 'eventslist':[]},
00187                  {'day':21, 'event': 0, 'eventslist':[]},
00188                  {'day':22, 'event': 0, 'eventslist':[]},
00189                  {'day':23, 'event': 0, 'eventslist':[]},
00190                  {'day':24, 'event': 0, 'eventslist':[]},
00191                  {'day':25, 'event': 0, 'eventslist':[]},
00192                  ],
00193                 [
00194                  {'day':26, 'event': 0, 'eventslist':[]},
00195                  {'day':27, 'event': 0, 'eventslist':[]},
00196                  {'day':28, 'event': 0, 'eventslist':[]},
00197                  {'day':29, 'event': 0, 'eventslist':[]},
00198                  {'day':30, 'event': 0, 'eventslist':[]},
00199                  {'day':31, 'event': 0, 'eventslist':[]},
00200                  {'day': 0, 'event': 0, 'eventslist':[]},
00201                  ]
00202                 ]
00203         result = caltool.getEventsForCalendar(month='5', year='2002')
00204         self.assertEqual(result, data)

Definition at line 476 of file test_Calendar.py.

00476 
00477     def test_singleDayRendering(self):
00478         site = self.app.site
00479         caltool = self.app.site.portal_calendar
00480         wftool = self.app.site.portal_workflow
00481 
00482         site.Members.invokeFactory(type_name="Event",id='Event1')
00483         event = site.Members.Event1
00484         event.edit( title='title'
00485                     , description='description'
00486                     , eventType=( 'eventType', )
00487                     , effectiveDay=1
00488                     , effectiveMo=5
00489                     , effectiveYear=2002
00490                     , expirationDay=31
00491                     , expirationMo=5
00492                     , expirationYear=2002
00493                     , start_time="00:00"
00494                     , startAMPM="AM"
00495                     , stop_time="11:59"
00496                     , stopAMPM="PM"
00497                     )
00498         wftool.doActionFor(event, 'publish', comment='testing')
00499         events = caltool.getEventsForThisDay(thisDay=DateTime('2002/5/1'))
00500         self.assertEqual( len(events), 1 )
00501 
00502         site.Members.invokeFactory(type_name="Event",id='Event2')
00503         event = site.Members.Event2
00504         event.edit( title='title'
00505                     , description='description'
00506                     , eventType=( 'eventType', )
00507                     , effectiveDay=1
00508                     , effectiveMo=5
00509                     , effectiveYear=2002
00510                     , expirationDay=1
00511                     , expirationMo=5
00512                     , expirationYear=2002
00513                     , start_time="00:00"
00514                     , startAMPM="AM"
00515                     , stop_time="11:59"
00516                     , stopAMPM="PM"
00517                     )
00518         wftool.doActionFor(event, 'publish', comment='testing')
00519         events = caltool.getEventsForThisDay(thisDay=DateTime('2002/5/1'))
00520         self.assertEqual( len(events), 2 )
00521 
00522         site.Members.invokeFactory(type_name="Event",id='Event3')
00523         event = site.Members.Event3
00524         event.edit( title='title'
00525                     , description='description'
00526                     , eventType=( 'eventType', )
00527                     , effectiveDay=12
00528                     , effectiveMo=12
00529                     , effectiveYear=2001
00530                     , expirationDay=1
00531                     , expirationMo=5
00532                     , expirationYear=2002
00533                     , start_time="00:00"
00534                     , startAMPM="AM"
00535                     , stop_time="11:59"
00536                     , stopAMPM="PM"
00537                     )
00538         wftool.doActionFor(event, 'publish', comment='testing')
00539         events = caltool.getEventsForThisDay(thisDay=DateTime('2002/5/1'))
00540         self.assertEqual( len(events), 3 )
00541 
00542         site.Members.invokeFactory(type_name="Event",id='Event4')
00543         event = site.Members.Event4
00544         event.edit( title='title'
00545                     , description='description'
00546                     , eventType=( 'eventType', )
00547                     , effectiveDay=12
00548                     , effectiveMo=12
00549                     , effectiveYear=2001
00550                     , expirationDay=31
00551                     , expirationMo=5
00552                     , expirationYear=2002
00553                     , start_time="00:00"
00554                     , startAMPM="AM"
00555                     , stop_time="11:59"
00556                     , stopAMPM="PM"
00557                     )
00558         wftool.doActionFor(event, 'publish', comment='testing')
00559         events = caltool.getEventsForThisDay(thisDay=DateTime('2002/5/1'))
00560         self.assertEqual( len(events), 4 )
00561 
00562         site.Members.invokeFactory(type_name="Event",id='Event5')
00563         event = site.Members.Event5
00564         event.edit( title='title'
00565                     , description='description'
00566                     , eventType=( 'eventType', )
00567                     , effectiveDay=31
00568                     , effectiveMo=5
00569                     , effectiveYear=2002
00570                     , expirationDay=31
00571                     , expirationMo=5
00572                     , expirationYear=2002
00573                     , start_time="00:00"
00574                     , startAMPM="AM"
00575                     , stop_time="11:59"
00576                     , stopAMPM="PM"
00577                     )
00578         wftool.doActionFor(event, 'publish', comment='testing')
00579         events = caltool.getEventsForThisDay(thisDay=DateTime('2002/5/1'))
00580         self.assertEqual( len(events), 4 )
00581         events = caltool.getEventsForThisDay(thisDay=DateTime('2002/5/31'))
00582         self.assertEqual( len(events), 3 )

Definition at line 205 of file test_Calendar.py.

00205 
00206     def test_singleEventCalendarRendering(self):
00207         site = self.app.site
00208         caltool = self.app.site.portal_calendar
00209         site.Members.invokeFactory(type_name="Event",id='Event1')
00210         event = self.app.restrictedTraverse('/site/Members/Event1')
00211         event.edit( title='title'
00212                     , description='description'
00213                     , eventType=( 'eventType', )
00214                     , effectiveDay=1
00215                     , effectiveMo=5
00216                     , effectiveYear=2002
00217                     , expirationDay=1
00218                     , expirationMo=5
00219                     , expirationYear=2002
00220                     , start_time="00:00"
00221                     , startAMPM="AM"
00222                     , stop_time="11:59"
00223                     , stopAMPM="PM"
00224                     )
00225         site.portal_workflow.doActionFor(event, 'publish', comment='testing')
00226 
00227         data = [
00228                 [
00229                  {'day': 0, 'event': 0, 'eventslist':[]},
00230                  {'day': 0, 'event': 0, 'eventslist':[]},
00231                  {'day': 0, 'event': 0, 'eventslist':[]},
00232                  {'day': 1, 'event': 1, 'eventslist':[{'title': 'title',
00233                                                        'end': '23:59:00',
00234                                                        'start': '00:00:00'}]},
00235                  {'day': 2, 'event': 0, 'eventslist':[]},
00236                  {'day': 3, 'event': 0, 'eventslist':[]},
00237                  {'day': 4, 'event': 0, 'eventslist':[]},
00238                  ],
00239                 [
00240                  {'day': 5, 'event': 0, 'eventslist':[]},
00241                  {'day': 6, 'event': 0, 'eventslist':[]},
00242                  {'day': 7, 'event': 0, 'eventslist':[]},
00243                  {'day': 8, 'event': 0, 'eventslist':[]},
00244                  {'day': 9, 'event': 0, 'eventslist':[]},
00245                  {'day':10, 'event': 0, 'eventslist':[]},
00246                  {'day':11, 'event': 0, 'eventslist':[]},
00247                  ],
00248                 [
00249                  {'day':12, 'event': 0, 'eventslist':[]},
00250                  {'day':13, 'event': 0, 'eventslist':[]},
00251                  {'day':14, 'event': 0, 'eventslist':[]},
00252                  {'day':15, 'event': 0, 'eventslist':[]},
00253                  {'day':16, 'event': 0, 'eventslist':[]},
00254                  {'day':17, 'event': 0, 'eventslist':[]},
00255                  {'day':18, 'event': 0, 'eventslist':[]},
00256                  ],
00257                 [
00258                  {'day':19, 'event': 0, 'eventslist':[]},
00259                  {'day':20, 'event': 0, 'eventslist':[]},
00260                  {'day':21, 'event': 0, 'eventslist':[]},
00261                  {'day':22, 'event': 0, 'eventslist':[]},
00262                  {'day':23, 'event': 0, 'eventslist':[]},
00263                  {'day':24, 'event': 0, 'eventslist':[]},
00264                  {'day':25, 'event': 0, 'eventslist':[]},
00265                  ],
00266                 [
00267                  {'day':26, 'event': 0, 'eventslist':[]},
00268                  {'day':27, 'event': 0, 'eventslist':[]},
00269                  {'day':28, 'event': 0, 'eventslist':[]},
00270                  {'day':29, 'event': 0, 'eventslist':[]},
00271                  {'day':30, 'event': 0, 'eventslist':[]},
00272                  {'day':31, 'event': 0, 'eventslist':[]},
00273                  {'day': 0, 'event': 0, 'eventslist':[]},
00274                  ]
00275                 ]
00276         result = caltool.getEventsForCalendar(month='5', year='2002')
00277         self.assertEqual(result, data)

Definition at line 320 of file test_Calendar.py.

00320 
00321     def test_spanningEventCalendarRendering(self):
00322         site = self.app.site
00323         caltool = self.app.site.portal_calendar
00324         site.Members.invokeFactory(type_name="Event",id='Event1')
00325         event = self.app.restrictedTraverse('/site/Members/Event1')
00326         event.edit( title='title'
00327                     , description='description'
00328                     , eventType=( 'eventType', )
00329                     , effectiveDay=1
00330                     , effectiveMo=5
00331                     , effectiveYear=2002
00332                     , expirationDay=31
00333                     , expirationMo=5
00334                     , expirationYear=2002
00335                     , start_time="00:00"
00336                     , startAMPM="AM"
00337                     , stop_time="11:59"
00338                     , stopAMPM="PM"
00339                     )
00340         site.portal_workflow.doActionFor(event, 'publish', comment='testing')
00341 
00342         data = [
00343                 [
00344                  {'day': 0, 'event': 0, 'eventslist':[]},
00345                  {'day': 0, 'event': 0, 'eventslist':[]},
00346                  {'day': 0, 'event': 0, 'eventslist':[]},
00347                  {'day': 1, 'event': 1, 'eventslist':[{'title': 'title',
00348                                                        'end': None,
00349                                                        'start': '00:00:00'}]},
00350                  {'day': 2, 'event': 1, 'eventslist':[{'title': 'title',
00351                                                        'end': None,
00352                                                        'start': None}]},
00353                  {'day': 3, 'event': 1, 'eventslist':[{'title': 'title',
00354                                                        'end': None,
00355                                                        'start': None}]},
00356                  {'day': 4, 'event': 1, 'eventslist':[{'title': 'title',
00357                                                        'end': None,
00358                                                        'start': None}]},
00359                 ],
00360                 [
00361                  {'day': 5, 'event': 1, 'eventslist':[{'title': 'title',
00362                                                        'end': None,
00363                                                        'start': None}]},
00364                  {'day': 6, 'event': 1, 'eventslist':[{'title': 'title',
00365                                                        'end': None,
00366                                                        'start': None}]},
00367                  {'day': 7, 'event': 1, 'eventslist':[{'title': 'title',
00368                                                        'end': None,
00369                                                        'start': None}]},
00370                  {'day': 8, 'event': 1, 'eventslist':[{'title': 'title',
00371                                                        'end': None,
00372                                                        'start': None}]},
00373                  {'day': 9, 'event': 1, 'eventslist':[{'title': 'title',
00374                                                        'end': None,
00375                                                        'start': None}]},
00376                  {'day':10, 'event': 1, 'eventslist':[{'title': 'title',
00377                                                        'end': None,
00378                                                        'start': None}]},
00379                  {'day':11, 'event': 1, 'eventslist':[{'title': 'title',
00380                                                        'end': None,
00381                                                        'start': None}]},
00382                 ],
00383                 [
00384                  {'day':12, 'event': 1, 'eventslist':[{'title': 'title',
00385                                                        'end': None,
00386                                                        'start': None}]},
00387                  {'day':13, 'event': 1, 'eventslist':[{'title': 'title',
00388                                                        'end': None,
00389                                                        'start': None}]},
00390                  {'day':14, 'event': 1, 'eventslist':[{'title': 'title',
00391                                                        'end': None,
00392                                                        'start': None}]},
00393                  {'day':15, 'event': 1, 'eventslist':[{'title': 'title',
00394                                                        'end': None,
00395                                                        'start': None}]},
00396                  {'day':16, 'event': 1, 'eventslist':[{'title': 'title',
00397                                                        'end': None,
00398                                                        'start': None}]},
00399                  {'day':17, 'event': 1, 'eventslist':[{'title': 'title',
00400                                                        'end': None,
00401                                                        'start': None}]},
00402                  {'day':18, 'event': 1, 'eventslist':[{'title': 'title',
00403                                                        'end': None,
00404                                                        'start': None}]},
00405                 ],
00406                 [
00407                  {'day':19, 'event': 1, 'eventslist':[{'title': 'title',
00408                                                        'end': None,
00409                                                        'start': None}]},
00410                  {'day':20, 'event': 1, 'eventslist':[{'title': 'title',
00411                                                        'end': None,
00412                                                        'start': None}]},
00413                  {'day':21, 'event': 1, 'eventslist':[{'title': 'title',
00414                                                        'end': None,
00415                                                        'start': None}]},
00416                  {'day':22, 'event': 1, 'eventslist':[{'title': 'title',
00417                                                        'end': None,
00418                                                        'start': None}]},
00419                  {'day':23, 'event': 1, 'eventslist':[{'title': 'title',
00420                                                        'end': None,
00421                                                        'start': None}]},
00422                  {'day':24, 'event': 1, 'eventslist':[{'title': 'title',
00423                                                        'end': None,
00424                                                        'start': None}]},
00425                  {'day':25, 'event': 1, 'eventslist':[{'title': 'title',
00426                                                        'end': None,
00427                                                        'start': None}]},
00428                  ],
00429                 [
00430                  {'day':26, 'event': 1, 'eventslist':[{'title': 'title',
00431                                                        'end': None,
00432                                                        'start': None}]},
00433                  {'day':27, 'event': 1, 'eventslist':[{'title': 'title',
00434                                                        'end': None,
00435                                                        'start': None}]},
00436                  {'day':28, 'event': 1, 'eventslist':[{'title': 'title',
00437                                                        'end': None,
00438                                                        'start': None}]},
00439                  {'day':29, 'event': 1, 'eventslist':[{'title': 'title',
00440                                                        'end': None,
00441                                                        'start': None}]},
00442                  {'day':30, 'event': 1, 'eventslist':[{'title': 'title',
00443                                                        'end': None,
00444                                                        'start': None}]},
00445                  {'day':31, 'event': 1, 'eventslist':[{'title': 'title',
00446                                                        'end': '23:59:00',
00447                                                        'start': None}]},
00448                  {'day': 0, 'event': 0, 'eventslist':[]},
00449                 ]
00450                ]
00451         result = caltool.getEventsForCalendar(month='5', year='2002')
00452         self.assertEqual(result, data)

Definition at line 644 of file test_Calendar.py.

00644 
00645     def test_workflowStateRendering(self):
00646         # Calendar should return events in all of the selected workflow states
00647         site = self.app.site
00648         caltool = self.app.site.portal_calendar
00649         site.invokeFactory('Event', id='meeting',
00650                            start_date='2002/05/01 11:00:00',
00651                            end_date='2002/05/01 13:30:00')
00652 
00653         site.invokeFactory('Event', id='dinner',
00654                            start_date='2002/05/01 20:00:00',
00655                            end_date='2002/05/01 22:00:00')
00656 
00657         self.assertEqual(len(site.portal_catalog(portal_type='Event')), 2)
00658 
00659         # No published events
00660         self.assertEqual(
00661             len(caltool.getEventsForThisDay(DateTime('2002/05/01'))), 0)
00662 
00663         # One published event
00664         site.portal_workflow.doActionFor(site.meeting, 'publish')
00665         self.assertEqual(len(site.portal_catalog(review_state='published')), 1)
00666 
00667         self.assertEqual(
00668             len(caltool.getEventsForThisDay(DateTime('2002/05/01'))), 1)
00669 
00670         # One pending event
00671         site.portal_workflow.doActionFor(site.dinner, 'submit')
00672         self.assertEqual(len(site.portal_catalog(review_state='pending')), 1)
00673 
00674         self.assertEqual(
00675             len(caltool.getEventsForThisDay(DateTime('2002/05/01'))), 1)
00676 
00677         # Make calendar return pending events
00678         caltool.edit_configuration(show_types=('Event',),
00679                                    show_states=('pending', 'published'),
00680                                    use_session='')
00681 
00682         self.assertEqual(
00683             len(caltool.getEventsForThisDay(DateTime('2002/05/01'))), 2)


Member Data Documentation

Definition at line 108 of file test_Calendar.py.


The documentation for this class was generated from the following file: