Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testElements
def testYears
def testMonths
def testDays
def testHours
def testMinutes
def testAM
def testPM
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 d

Detailed Description

Definition at line 15 of file testDateComponentsSupport.py.


Member Function Documentation

Definition at line 17 of file testDateComponentsSupport.py.

00017 
00018     def afterSetUp(self):
00019         date = DateTime(2002, 8, 1, 17, 42, 0)
00020         self.d = self.portal.date_components_support(date)

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 160 of file testDateComponentsSupport.py.

00160 
00161     def testAM(self):
00162         d = DateTime(2002, 8, 1, 3, 0, 0)
00163         d = self.portal.date_components_support(d)
00164         self.assertEqual(d.get('ampm'), [])

Definition at line 66 of file testDateComponentsSupport.py.

00066 
00067     def testDays(self):
00068         data = [
00069             {'selected': None, 'id': '--', 'value': '00'},
00070             {'selected': 1,    'id': 1,      'value': '01'},
00071             {'selected': None, 'id': 2,      'value': '02'},
00072             {'selected': None, 'id': 3,      'value': '03'},
00073             {'selected': None, 'id': 4,      'value': '04'},
00074             {'selected': None, 'id': 5,      'value': '05'},
00075             {'selected': None, 'id': 6,      'value': '06'},
00076             {'selected': None, 'id': 7,      'value': '07'},
00077             {'selected': None, 'id': 8,      'value': '08'},
00078             {'selected': None, 'id': 9,      'value': '09'},
00079             {'selected': None, 'id': 10,     'value': '10'},
00080             {'selected': None, 'id': 11,     'value': '11'},
00081             {'selected': None, 'id': 12,     'value': '12'},
00082             {'selected': None, 'id': 13,     'value': '13'},
00083             {'selected': None, 'id': 14,     'value': '14'},
00084             {'selected': None, 'id': 15,     'value': '15'},
00085             {'selected': None, 'id': 16,     'value': '16'},
00086             {'selected': None, 'id': 17,     'value': '17'},
00087             {'selected': None, 'id': 18,     'value': '18'},
00088             {'selected': None, 'id': 19,     'value': '19'},
00089             {'selected': None, 'id': 20,     'value': '20'},
00090             {'selected': None, 'id': 21,     'value': '21'},
00091             {'selected': None, 'id': 22,     'value': '22'},
00092             {'selected': None, 'id': 23,     'value': '23'},
00093             {'selected': None, 'id': 24,     'value': '24'},
00094             {'selected': None, 'id': 25,     'value': '25'},
00095             {'selected': None, 'id': 26,     'value': '26'},
00096             {'selected': None, 'id': 27,     'value': '27'},
00097             {'selected': None, 'id': 28,     'value': '28'},
00098             {'selected': None, 'id': 29,     'value': '29'},
00099             {'selected': None, 'id': 30,     'value': '30'},
00100             {'selected': None, 'id': 31,     'value': '31'},
00101         ]
00102     
00103         days = self.d.get('days')
00104         for i in range(32):
00105             self.assertEqual(days[i], data[i])

Definition at line 21 of file testDateComponentsSupport.py.

00021 
00022     def testElements(self):
00023         self.assertEqual(sortTuple(self.d.keys()), 
00024                 ('ampm', 'days', 'hours', 'minutes', 'months', 'years'))

Here is the call graph for this function:

Definition at line 106 of file testDateComponentsSupport.py.

00106 
00107     def testHours(self):
00108         data = [
00109             {'selected': None, 'id': '--', 'value': '00'},
00110             {'selected': None, 'id': '00',   'value': '00'},
00111             {'selected': None, 'id': '01',   'value': '01'},
00112             {'selected': None, 'id': '02',   'value': '02'},
00113             {'selected': None, 'id': '03',   'value': '03'},
00114             {'selected': None, 'id': '04',   'value': '04'},
00115             {'selected': None, 'id': '05',   'value': '05'},
00116             {'selected': None, 'id': '06',   'value': '06'},
00117             {'selected': None, 'id': '07',   'value': '07'},
00118             {'selected': None, 'id': '08',   'value': '08'},
00119             {'selected': None, 'id': '09',   'value': '09'},
00120             {'selected': None, 'id': '10',   'value': '10'},
00121             {'selected': None, 'id': '11',   'value': '11'},
00122             {'selected': None, 'id': '12',   'value': '12'},
00123             {'selected': None, 'id': '13',   'value': '13'},
00124             {'selected': None, 'id': '14',   'value': '14'},
00125             {'selected': None, 'id': '15',   'value': '15'},
00126             {'selected': None, 'id': '16',   'value': '16'},
00127             {'selected': 1,    'id': '17',   'value': '17'},
00128             {'selected': None, 'id': '18',   'value': '18'},
00129             {'selected': None, 'id': '19',   'value': '19'},
00130             {'selected': None, 'id': '20',   'value': '20'},
00131             {'selected': None, 'id': '21',   'value': '21'},
00132             {'selected': None, 'id': '22',   'value': '22'},
00133             {'selected': None, 'id': '23',   'value': '23'},
00134         ]
00135 
00136         hours = self.d.get('hours')
00137         for i in range(25):
00138             self.assertEqual(hours[i], data[i])

Definition at line 139 of file testDateComponentsSupport.py.

00139 
00140     def testMinutes(self):
00141         data = [
00142             {'selected': None, 'id': '--', 'value': '00'},
00143             {'selected': None, 'id': '00',   'value': '00'},
00144             {'selected': None, 'id': '05',   'value': '05'},
00145             {'selected': None, 'id': '10',   'value': '10'},
00146             {'selected': None, 'id': '15',   'value': '15'},
00147             {'selected': None, 'id': '20',   'value': '20'},
00148             {'selected': None, 'id': '25',   'value': '25'},
00149             {'selected': None, 'id': '30',   'value': '30'},
00150             {'selected': None, 'id': '35',   'value': '35'},
00151             {'selected': None, 'id': '40',   'value': '40'},
00152             {'selected': 1,    'id': '45',   'value': '45'},
00153             {'selected': None, 'id': '50',   'value': '50'},
00154             {'selected': None, 'id': '55',   'value': '55'},
00155         ]
00156 
00157         minutes = self.d.get('minutes')
00158         for i in range(13):
00159             self.assertEqual(minutes[i], data[i])

Definition at line 45 of file testDateComponentsSupport.py.

00045 
00046     def testMonths(self):
00047         data = [
00048             {'selected': None, 'id': '--',      'value': '00'},
00049             {'selected': None, 'id': 'January',   'value': '01'},
00050             {'selected': None, 'id': 'February',  'value': '02'},
00051             {'selected': None, 'id': 'March',     'value': '03'},
00052             {'selected': None, 'id': 'April',     'value': '04'},
00053             {'selected': None, 'id': 'May',       'value': '05'},
00054             {'selected': None, 'id': 'June',      'value': '06'},
00055             {'selected': None, 'id': 'July',      'value': '07'},
00056             {'selected': 1,    'id': 'August',    'value': '08'},
00057             {'selected': None, 'id': 'September', 'value': '09'},
00058             {'selected': None, 'id': 'October',   'value': '10'},
00059             {'selected': None, 'id': 'November',  'value': '11'},
00060             {'selected': None, 'id': 'December',  'value': '12'},
00061         ]
00062 
00063         months = self.d.get('months')
00064         for i in range(13):
00065             self.assertEqual(months[i], data[i])

Definition at line 165 of file testDateComponentsSupport.py.

00165 
00166     def testPM(self):
00167         ampm = self.d.get('ampm')
00168         self.assertEqual(ampm, [])
00169 

Definition at line 25 of file testDateComponentsSupport.py.

00025 
00026     def testYears(self):
00027         this_year = DateTime().year()
00028         site_properties = self.portal.portal_properties.site_properties
00029         min_year = site_properties.getProperty('calendar_starting_year', 1999)
00030         max_year = site_properties.getProperty('calendar_future_years_available', 5) + this_year
00031 
00032         data = [
00033             {'selected': None, 'id': '--', 'value': '0000'}
00034         ]
00035 
00036         for y in range(min_year, max_year+1):
00037             d = {'selected': None, 'id': y, 'value': y}
00038             if y == 2002:
00039                 d['selected'] = 1
00040             data.append(d)
00041 
00042         years = self.d.get('years')
00043         for i in range(max_year - min_year + 1):
00044             self.assertEqual(years[i], data[i])


Member Data Documentation

Definition at line 19 of file testDateComponentsSupport.py.


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