Exemple #1
0
 def testGetNextMonth(self):
     view = CalendarPortlet(self.portal, self.app.REQUEST)
     result = view.getNextMonth(12, 2006)
     self.failUnlessEqual(result, DateTime(2007, 1, 1))
     
     result = view.getNextMonth(1, 2006)
     self.failUnlessEqual(result, DateTime(2006, 2, 1))
Exemple #2
0
 def testGetYearAndMonthToDisplay(self):
     """CalendarPortlet.getYearAndMonthToDisplay() must return the current
        year and month.
     """
     view = CalendarPortlet(self.portal, self.app.REQUEST)
     result = view.getYearAndMonthToDisplay()
     self.failUnlessEqual(result, (self.now.year(), self.now.month()))
Exemple #3
0
 def testGetYearAndMonthToDisplayRequest(self):
     """CalendarPortlet.getYearAndMonthToDisplay() must return the year and
        month found in REQUEST variables.
     """
     self.app.REQUEST['year'] = 2005
     self.app.REQUEST['month'] = 7
     view = CalendarPortlet(self.portal, self.app.REQUEST)
     result = view.getYearAndMonthToDisplay()
     self.failUnlessEqual(result, (2005, 7))
Exemple #4
0
 def testGetYearAndMonthToDisplaySession(self):
     """CalendarPortlet.getYearAndMonthToDisplay() must return the year and
        month found in SESSION variables if this is enables in the calendar
        tool.
     """
     usesession = self.calendar.getUseSession()
     self.app.REQUEST['SESSION'] = FakeRequestSession()
     self.app.REQUEST['SESSION']['calendar_year'] = 2004
     self.app.REQUEST['SESSION']['calendar_month'] = 6
     
     # Ignore the session variables and use the current date
     self.calendar.use_session = False
     view = CalendarPortlet(self.portal, self.app.REQUEST)
     result = view.getYearAndMonthToDisplay()
     self.failUnlessEqual(result, (self.now.year(), self.now.month()))
     
     # Use the session variables
     self.calendar.use_session = True
     view = CalendarPortlet(self.portal, self.app.REQUEST)
     result = view.getYearAndMonthToDisplay()
     self.failUnlessEqual(result, (2004, 6))
     
     # Restore the orginal value
     self.calendar.use_session = usesession
Exemple #5
0
 def testIsToday(self):
     view = CalendarPortlet(self.portal, self.app.REQUEST)
     self.failUnless(view.isToday(self.now.day()))