Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFCalendar.tests.test_Calendar.CalendarTests Class Reference

List of all members.

Public Member Functions

def test_z3interfaces
def test_new
def test_types
def test_states
def test_days
def test_firstweekday

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 32 of file test_Calendar.py.


Member Function Documentation

Definition at line 34 of file test_Calendar.py.

00034 
00035     def _getTargetClass(self):
00036         from Products.CMFCalendar.CalendarTool import CalendarTool
00037 
00038         return CalendarTool

def CMFCalendar.tests.test_Calendar.CalendarTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 39 of file test_Calendar.py.

00039 
00040     def _makeOne(self, *args, **kw):
00041         return self._getTargetClass()(*args, **kw)

Here is the call graph for this function:

Definition at line 70 of file test_Calendar.py.

00070 
00071     def test_days(self):
00072         ctool = self._makeOne()
00073         old_locale = locale.getlocale(locale.LC_ALL)[0]
00074         locale.setlocale(locale.LC_ALL, 'C')
00075         try:
00076             self.assertEqual( ctool.getDays(),
00077                               ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] )
00078         finally:
00079             locale.setlocale(locale.LC_ALL, old_locale)

Here is the call graph for this function:

Definition at line 80 of file test_Calendar.py.

00080 
00081     def test_firstweekday(self):
00082         ctool = self._makeOne()
00083         ctool.firstweekday = 6
00084         self.assertEqual(ctool.getFirstWeekDay(), 6)
00085 
00086         # Try setting it to invalid values, the setting should not stick
00087         ctool.edit_configuration([], None, firstweekday='insane')
00088         self.assertEqual(ctool.getFirstWeekDay(), 6)
00089 
00090         ctool.edit_configuration([], None, firstweekday=42)
00091         self.assertEqual(ctool.getFirstWeekDay(), 6)
00092 
00093         # Set it to a sane value
00094         ctool.edit_configuration([], None, firstweekday=0)
00095         self.assertEqual(ctool.getFirstWeekDay(), 0)
00096 
00097         # Make sure the setting is being used...
00098         old_locale = locale.getlocale(locale.LC_ALL)[0]
00099         locale.setlocale(locale.LC_ALL, 'C')
00100         try:
00101             self.assertEqual( ctool.getDays(),
00102                               ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa','Su'] )
00103         finally:
00104             locale.setlocale(locale.LC_ALL, old_locale)
00105 

Here is the call graph for this function:

Definition at line 48 of file test_Calendar.py.

00048 
00049     def test_new(self):
00050         ctool = self._makeOne()
00051         self.assertEqual( ctool.getId(), 'portal_calendar' )

Here is the call graph for this function:

Definition at line 61 of file test_Calendar.py.

00061 
00062     def test_states(self):
00063         ctool = self._makeOne()
00064         self.assertEqual(ctool.getCalendarStates(), ('published',))
00065 
00066         ctool.edit_configuration(show_types=[],
00067                                  show_states=['pending', 'published'],
00068                                  use_session="")
00069         self.assertEqual( ctool.getCalendarStates(), ('pending', 'published') )

Here is the call graph for this function:

Definition at line 52 of file test_Calendar.py.

00052 
00053     def test_types(self):
00054         ctool = self._makeOne()
00055         self.assertEqual(ctool.getCalendarTypes(), ('Event',))
00056 
00057         ctool.edit_configuration(show_types=['Event','Party'],
00058                                  show_states=[],
00059                                  use_session="")
00060         self.assertEqual( ctool.getCalendarTypes(), ('Event', 'Party') )

Here is the call graph for this function:

Definition at line 42 of file test_Calendar.py.

00042 
00043     def test_z3interfaces(self):
00044         from zope.interface.verify import verifyClass
00045         from Products.CMFCalendar.interfaces import ICalendarTool
00046 
00047         verifyClass(ICalendarTool, self._getTargetClass())

Here is the call graph for this function:


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