Example #1
0
 def test_start_stop_last_hour(self):
     with patch('zato.common.util._utcnow', self._utcnow):
         info = get_default_date('last_hour', self.user_profile, 'date_time')
         eq_(info.utc_start, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.utc_stop, '2012-03-01T00:47:24.054903+00:00')
         eq_(info.user_start, '01-03-2012 00:47:24')
         eq_(info.user_stop, '01-03-2012 01:47:24')
         eq_(info.label, 'Last hour')
         eq_(info.step, 'hour')
Example #2
0
 def test_start_stop_this_week(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('this_week', self.user_profile, 'date')
         eq_(info.utc_start, '2012-02-26T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.user_start, '27-02-2012')
         eq_(info.user_stop, '01-03-2012') # The date now() returns
         eq_(info.label, 'This week')
         eq_(info.step, 'week')
Example #3
0
 def test_start_stop_this_year(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('this_year', self.user_profile, 'year')
         eq_(info.utc_start, '2011-12-31T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.user_start, '2012')
         eq_(info.user_stop, '')
         eq_(info.label, 'This year')
         eq_(info.step, 'year')
Example #4
0
 def test_start_stop_today(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('today', self.user_profile, 'date')
         eq_(info.utc_start, '2012-02-29T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.user_start, '01-03-2012')
         eq_(info.user_stop, '')
         eq_(info.label, 'Today')
         eq_(info.step, 'day')
Example #5
0
 def test_start_stop_yesterday(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('yesterday', self.user_profile, 'date')
         eq_(info.utc_start, '2012-02-28T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:00:00+00:00')
         eq_(info.user_start, '29-02-2012')
         eq_(info.user_stop, '')
         eq_(info.label, 'Yesterday')
         eq_(info.step, 'day')
Example #6
0
 def test_start_stop_this_year(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('this_year', self.user_profile, 'year')
         eq_(info.utc_start, '2011-12-31T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.user_start, '2012')
         eq_(info.user_stop, '')
         eq_(info.label, 'This year')
         eq_(info.step, 'year')
Example #7
0
 def test_start_stop_this_week(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('this_week', self.user_profile, 'date')
         eq_(info.utc_start, '2012-02-26T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.user_start, '27-02-2012')
         eq_(info.user_stop, '01-03-2012')  # The date now() returns
         eq_(info.label, 'This week')
         eq_(info.step, 'week')
Example #8
0
 def test_start_stop_yesterday(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('yesterday', self.user_profile, 'date')
         eq_(info.utc_start, '2012-02-28T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:00:00+00:00')
         eq_(info.user_start, '29-02-2012')
         eq_(info.user_stop, '')
         eq_(info.label, 'Yesterday')
         eq_(info.step, 'day')
Example #9
0
 def test_start_stop_today(self):
     with patch('zato.common.util._now', self._now):
         info = get_default_date('today', self.user_profile, 'date')
         eq_(info.utc_start, '2012-02-29T23:00:00+00:00')
         eq_(info.utc_stop, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.user_start, '01-03-2012')
         eq_(info.user_stop, '')
         eq_(info.label, 'Today')
         eq_(info.step, 'day')
Example #10
0
 def test_start_stop_last_hour(self):
     with patch('zato.common.util._utcnow', self._utcnow):
         info = get_default_date('last_hour', self.user_profile, 'date_time')
         eq_(info.utc_start, '2012-02-29T23:47:24.054903+00:00')
         eq_(info.utc_stop, '2012-03-01T00:47:24.054903+00:00')
         eq_(info.user_start, '01-03-2012 00:47:24')
         eq_(info.user_stop, '01-03-2012 01:47:24')
         eq_(info.label, 'Last hour')
         eq_(info.step, 'hour')