Beispiel #1
0
 def test_shift_prev_hour2(self):
     now = parse('2012-10-30T21:09:02.141791+00:00')
     info = shift(now, '2012-10-30 23:09:02', self.user_profile, 'last_hour_prev', 'hour', 'date_time')
     eq_(info.utc_start, '2012-10-30T20:09:02.141791+00:00')
     eq_(info.utc_stop, '2012-10-30T21:09:02.141791+00:00')
     eq_(info.user_start, '30-10-2012 21:09:02')
     eq_(info.user_stop, '30-10-2012 22:09:02')
     eq_(info.step, None)
Beispiel #2
0
 def test_shift_prev_year_by_year(self):
     now = parse('2012-01-01T00:00:00+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'this_year_prev', 'year', 'year')
     eq_(info.utc_start, '2011-01-01T00:00:00+00:00')
     eq_(info.utc_stop, '2012-01-01T00:00:00+00:00')
     eq_(info.user_start, '2011')
     eq_(info.user_stop, '2012')
     eq_(info.step, None)
Beispiel #3
0
 def test_shift_prev_week_by_week(self):
     now = parse('2012-10-22T00:00:00+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'today_prev_day_week', 'week', 'date')
     eq_(info.utc_start, '2012-10-15T00:00:00+00:00')
     eq_(info.utc_stop, '2012-10-22T00:00:00+00:00')
     eq_(info.user_start, '15-10-2012')
     eq_(info.user_stop, '22-10-2012')
     eq_(info.step, None)
Beispiel #4
0
 def test_shift_prev_month_by_month(self):
     now = parse('2012-10-01T00:00:00+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile, 'month_year'), self.user_profile, 'this_month_prev_month', 'month', 'month_year')
     eq_(info.utc_start, '2012-08-31T22:00:00+00:00')
     eq_(info.utc_stop, '2012-09-30T22:00:00+00:00')
     eq_(info.user_start, '09-2012')
     eq_(info.user_stop, '10-2012')
     eq_(info.step, None)
 def test_shift_prev_hour2(self):
     now = parse('2012-10-30T21:09:02.141791+00:00')
     info = shift(now, '2012-10-30 23:09:02', self.user_profile, 'last_hour_prev', 'hour', 'date_time')
     eq_(info.utc_start, '2012-10-30T20:09:02.141791+00:00')
     eq_(info.utc_stop, '2012-10-30T21:09:02.141791+00:00')
     eq_(info.user_start, '30-10-2012 21:09:02')
     eq_(info.user_stop, '30-10-2012 22:09:02')
     eq_(info.step, None)
Beispiel #6
0
 def test_shift_prev_week_by_day(self):
     now = parse('2012-03-21T00:39:19+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'today_prev_day_week', 'day', 'date')
     eq_(info.utc_start, '2012-03-14T00:39:19+00:00')
     eq_(info.utc_stop, '2012-03-15T00:39:19+00:00')
     eq_(info.user_start, '14-03-2012')
     eq_(info.user_stop, '15-03-2012')
     eq_(info.step, None)
 def test_shift_prev_year_by_year(self):
     now = parse('2012-01-01T00:00:00+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'this_year_prev', 'year', 'year')
     eq_(info.utc_start, '2011-01-01T00:00:00+00:00')
     eq_(info.utc_stop, '2012-01-01T00:00:00+00:00')
     eq_(info.user_start, '2011')
     eq_(info.user_stop, '2012')
     eq_(info.step, None)
 def test_shift_prev_month_by_month(self):
     now = parse('2012-10-01T00:00:00+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile, 'month_year'), self.user_profile, 'this_month_prev_month', 'month', 'month_year')
     eq_(info.utc_start, '2012-08-31T22:00:00+00:00')
     eq_(info.utc_stop, '2012-09-30T22:00:00+00:00')
     eq_(info.user_start, '09-2012')
     eq_(info.user_stop, '10-2012')
     eq_(info.step, None)
 def test_shift_prev_week_by_week(self):
     now = parse('2012-10-22T00:00:00+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'today_prev_day_week', 'week', 'date')
     eq_(info.utc_start, '2012-10-15T00:00:00+00:00')
     eq_(info.utc_stop, '2012-10-22T00:00:00+00:00')
     eq_(info.user_start, '15-10-2012')
     eq_(info.user_stop, '22-10-2012')
     eq_(info.step, None)
Beispiel #10
0
 def test_shift_prev_week_by_day(self):
     now = parse('2012-03-21T00:39:19+00:00')
     info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'today_prev_day_week', 'day', 'date')
     eq_(info.utc_start, '2012-03-14T00:39:19+00:00')
     eq_(info.utc_stop, '2012-03-15T00:39:19+00:00')
     eq_(info.user_start, '14-03-2012')
     eq_(info.user_stop, '15-03-2012')
     eq_(info.step, None)
Beispiel #11
0
 def test_shift_prev_week(self):
     with patch('zato.common.util._utcnow', self._utcnow):
         now = utcnow()
         info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'today_prev_day_week', 'hour', 'date_time')
         eq_(info.utc_start, '2012-02-23T00:47:24.054903+00:00')
         eq_(info.utc_stop, '2012-02-23T01:47:24.054903+00:00')
         eq_(info.user_start, '23-02-2012 01:47:24')
         eq_(info.user_stop, '23-02-2012 02:47:24')
         eq_(info.step, None)
Beispiel #12
0
 def test_shift_prev_hour(self):
     with patch('zato.common.util._utcnow', self._utcnow):
         now = utcnow()
         info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'last_hour_prev', 'hour', '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.step, None)
Beispiel #13
0
 def test_shift_prev_day(self):
     with patch('zato.common.util._utcnow', self._utcnow):
         now = utcnow()
         info = shift(now, from_utc_to_user(now, self.user_profile), self.user_profile, 'today_prev_day', 'hour', 'date_time')
         eq_(info.utc_start, '2012-02-29T00:47:24.054903+00:00')
         eq_(info.utc_stop, '2012-02-29T01:47:24.054903+00:00')
         eq_(info.user_start, '29-02-2012 01:47:24')
         eq_(info.user_stop, '29-02-2012 02:47:24')
         eq_(info.step, None)