Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testCalendarView.TestCalendarPortletView Class Reference
Inheritance diagram for CMFPlone.tests.testCalendarView.TestCalendarPortletView:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testCalendarView.TestCalendarPortletView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testImplementsICalendarPortlet
def testGetYearAndMonthToDisplay
def testGetYearAndMonthToDisplayRequest
def testGetYearAndMonthToDisplaySession
def testGetPreviousMonth
def testGetNextMonth
def testIsToday
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 url
 calendar
 now

Detailed Description

Definition at line 24 of file testCalendarView.py.


Member Function Documentation

Definition at line 26 of file testCalendarView.py.

00026 
00027     def afterSetUp(self):
00028         self.url = self.portal.portal_url
00029         self.calendar = self.portal.portal_calendar
00030         self.now = DateTime()

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 86 of file testCalendarView.py.

00086 
00087     def testGetNextMonth(self):
00088         view = CalendarPortlet(self.portal, self.app.REQUEST)
00089         result = view.getNextMonth(12, 2006)
00090         self.failUnlessEqual(result, DateTime(2007, 1, 1))
00091         
00092         result = view.getNextMonth(1, 2006)
00093         self.failUnlessEqual(result, DateTime(2006, 2, 1))

Here is the call graph for this function:

Definition at line 78 of file testCalendarView.py.

00078 
00079     def testGetPreviousMonth(self):
00080         view = CalendarPortlet(self.portal, self.app.REQUEST)
00081         result = view.getPreviousMonth(12, 2006)
00082         self.failUnlessEqual(result, DateTime(2006, 11, 1))
00083         
00084         result = view.getPreviousMonth(1, 2006)
00085         self.failUnlessEqual(result, DateTime(2005, 12, 1))

Here is the call graph for this function:

CalendarPortlet.getYearAndMonthToDisplay() must return the current
   year and month.

Definition at line 35 of file testCalendarView.py.

00035 
00036     def testGetYearAndMonthToDisplay(self):
00037         """CalendarPortlet.getYearAndMonthToDisplay() must return the current
00038            year and month.
00039         """
00040         view = CalendarPortlet(self.portal, self.app.REQUEST)
00041         result = view.getYearAndMonthToDisplay()
00042         self.failUnlessEqual(result, (self.now.year(), self.now.month()))
        

Here is the call graph for this function:

CalendarPortlet.getYearAndMonthToDisplay() must return the year and
   month found in REQUEST variables.

Definition at line 43 of file testCalendarView.py.

00043 
00044     def testGetYearAndMonthToDisplayRequest(self):
00045         """CalendarPortlet.getYearAndMonthToDisplay() must return the year and
00046            month found in REQUEST variables.
00047         """
00048         self.app.REQUEST['year'] = 2005
00049         self.app.REQUEST['month'] = 7
00050         view = CalendarPortlet(self.portal, self.app.REQUEST)
00051         result = view.getYearAndMonthToDisplay()
00052         self.failUnlessEqual(result, (2005, 7))

Here is the call graph for this function:

CalendarPortlet.getYearAndMonthToDisplay() must return the year and
   month found in SESSION variables if this is enables in the calendar
   tool.

Definition at line 53 of file testCalendarView.py.

00053 
00054     def testGetYearAndMonthToDisplaySession(self):
00055         """CalendarPortlet.getYearAndMonthToDisplay() must return the year and
00056            month found in SESSION variables if this is enables in the calendar
00057            tool.
00058         """
00059         usesession = self.calendar.getUseSession()
00060         self.app.REQUEST['SESSION'] = FakeRequestSession()
00061         self.app.REQUEST['SESSION']['calendar_year'] = 2004
00062         self.app.REQUEST['SESSION']['calendar_month'] = 6
00063         
00064         # Ignore the session variables and use the current date
00065         self.calendar.use_session = False
00066         view = CalendarPortlet(self.portal, self.app.REQUEST)
00067         result = view.getYearAndMonthToDisplay()
00068         self.failUnlessEqual(result, (self.now.year(), self.now.month()))
00069         
00070         # Use the session variables
00071         self.calendar.use_session = True
00072         view = CalendarPortlet(self.portal, self.app.REQUEST)
00073         result = view.getYearAndMonthToDisplay()
00074         self.failUnlessEqual(result, (2004, 6))
00075         
00076         # Restore the orginal value
00077         self.calendar.use_session = usesession

Here is the call graph for this function:

CalendarPortlet must implement ICalendarPortlet

Definition at line 31 of file testCalendarView.py.

00031 
00032     def testImplementsICalendarPortlet(self):
00033         """CalendarPortlet must implement ICalendarPortlet"""
00034         self.failUnless(ICalendarPortlet.implementedBy(CalendarPortlet))

Definition at line 94 of file testCalendarView.py.

00094 
00095     def testIsToday(self):
00096         view = CalendarPortlet(self.portal, self.app.REQUEST)
00097         self.failUnless(view.isToday(self.now.day()))
00098 

Here is the call graph for this function:


Member Data Documentation

Definition at line 28 of file testCalendarView.py.

Definition at line 29 of file testCalendarView.py.

Definition at line 27 of file testCalendarView.py.


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