Пример #1
0
 def test_utcnow(self):
     self.assertIsInstance(utcnow(), datetime)
     date1 = get_date(datetime.now(tz=utc))
     date2 = utcnow()
     self.assertEqual(date1.year, date2.year)
     self.assertEqual(date1.month, date2.month)
     self.assertEqual(date1.day, date2.day)
     self.assertEqual(date1.hour, date2.hour)
     self.assertEqual(date1.minute, date2.minute)
     self.assertEqual(date1.second, date2.second)
Пример #2
0
 def test_utcnow(self):
     self.assertIsInstance(utcnow(), datetime)
     date1 = get_date(datetime.now(tz=utc))
     date2 = utcnow()
     self.assertEqual(date1.year, date2.year)
     self.assertEqual(date1.month, date2.month)
     self.assertEqual(date1.day, date2.day)
     self.assertEqual(date1.hour, date2.hour)
     self.assertEqual(date1.minute, date2.minute)
     self.assertEqual(date1.second, date2.second)
Пример #3
0
 def test_get_expiry_date_with_offset(self):
     offset = utcnow() + timedelta(minutes=10)
     date1 = offset + timedelta(minutes=5)
     date2 = get_expiry_date(minutes=5, offset=offset)
     self.assertEqual(date1.year, date2.year)
     self.assertEqual(date1.month, date2.month)
     self.assertEqual(date1.day, date2.day)
     self.assertEqual(date1.hour, date2.hour)
     self.assertEqual(date1.minute, date2.minute)
     self.assertEqual(date1.second, date2.second)
Пример #4
0
 def test_get_expiry_date(self):
     self.assertIsInstance(get_expiry_date(minutes=60), datetime)
     date1 = utcnow() + timedelta(minutes=60)
     date2 = get_expiry_date(minutes=60)
     self.assertEqual(date1.year, date2.year)
     self.assertEqual(date1.month, date2.month)
     self.assertEqual(date1.day, date2.day)
     self.assertEqual(date1.hour, date2.hour)
     self.assertEqual(date1.minute, date2.minute)
     self.assertEqual(date1.second, date2.second)
Пример #5
0
 def test_get_expiry_date_with_offset(self):
     offset = utcnow() + timedelta(minutes=10)
     date1 = offset + timedelta(minutes=5)
     date2 = get_expiry_date(minutes=5, offset=offset)
     self.assertEqual(date1.year, date2.year)
     self.assertEqual(date1.month, date2.month)
     self.assertEqual(date1.day, date2.day)
     self.assertEqual(date1.hour, date2.hour)
     self.assertEqual(date1.minute, date2.minute)
     self.assertEqual(date1.second, date2.second)
Пример #6
0
 def test_get_expiry_date(self):
     self.assertIsInstance(get_expiry_date(minutes=60), datetime)
     date1 = utcnow() + timedelta(minutes=60)
     date2 = get_expiry_date(minutes=60)
     self.assertEqual(date1.year, date2.year)
     self.assertEqual(date1.month, date2.month)
     self.assertEqual(date1.day, date2.day)
     self.assertEqual(date1.hour, date2.hour)
     self.assertEqual(date1.minute, date2.minute)
     self.assertEqual(date1.second, date2.second)