def test_missing_intervals_matched_cq_stats(self):
     CQStats(project='',
             interval_minutes=1440,
             begin=datetime(2000, 1, 2, 8),
             end=datetime(2000, 1, 3, 8)).put()
     self.assertEqual([
         (datetime(2000, 1, 3, 8), datetime(2000, 1, 4, 8)),
     ], missing_intervals(1440, datetime(2000, 1, 4, 8)))
 def test_missing_intervals_records_only(self):
     self.mock_now(datetime(2000, 1, 2, 0))
     Record().put()
     self.mock_now(datetime(2000, 1, 3, 0))
     Record().put()
     self.assertEqual([
         (datetime(2000, 1, 1, 8), datetime(2000, 1, 2, 8)),
         (datetime(2000, 1, 2, 8), datetime(2000, 1, 3, 8)),
     ], missing_intervals(1440, datetime(2000, 1, 4, 0)))
示例#3
0
 def test_missing_intervals_matched_cq_stats(self):
   _clear_ndb()
   CQStats(
     project='',
     interval_minutes=1440,
     begin=datetime(2000, 1, 2, 8),
     end=datetime(2000, 1, 3, 8)).put()
   self.assertEqual([
     (datetime(2000, 1, 3, 8), datetime(2000, 1, 4, 8)),
   ], missing_intervals(1440, datetime(2000, 1, 4, 8)))
示例#4
0
 def test_missing_intervals_records_only(self):
   _clear_ndb()
   self.mock_now(datetime(2000, 1, 2, 0))
   Record().put()
   self.mock_now(datetime(2000, 1, 3, 0))
   Record().put()
   self.assertEqual([
     (datetime(2000, 1, 1, 8), datetime(2000, 1, 2, 8)),
     (datetime(2000, 1, 2, 8), datetime(2000, 1, 3, 8)),
   ], missing_intervals(1440, datetime(2000, 1, 4, 0)))
 def test_missing_intervals_mismatched_cq_stats(self):
     CQStats(project='',
             interval_minutes=60,
             begin=datetime(2000, 1, 3, 7),
             end=datetime(2000, 1, 3, 8)).put()
     self.mock_now(datetime(2000, 1, 2, 0))
     Record().put()
     self.assertEqual([
         (datetime(2000, 1, 1, 8), datetime(2000, 1, 2, 8)),
         (datetime(2000, 1, 2, 8), datetime(2000, 1, 3, 8)),
     ], missing_intervals(1440, datetime(2000, 1, 4, 0)))
示例#6
0
 def test_missing_intervals_empty(self):
   _clear_ndb()
   self.assertEqual([], missing_intervals(60, datetime(2000, 1, 1)))
 def test_missing_intervals_empty(self):
     self.mock_current_user(is_admin=True)
     self.assertEqual([], missing_intervals(60, datetime(2000, 1, 1)))
     # Smoke test for coverage.
     self.test_app.get('/background/update-stats?interval_minutes=1440')