def testFilteredDistinctUserCount(self): # Now, move all the sections before a week # Now there should be no matches in the last week for section in self.SectionsColl.find(): section['section_start_datetime'] = self.weekago + timedelta(days = -1) section['section_end_datetime'] = self.weekago + timedelta(days = -1) + timedelta(hours = 1) # print("Section start = %s, section end = %s" % # (section['section_start_datetime'], section['section_end_datetime'])) self.SectionsColl.save(section) print "About to check for distinct users from a week ago" self.assertEqual(carbon.getDistinctUserCount(carbon.getQuerySpec(None, None, self.weekago, self.now)), 0) self.assertEqual(carbon.getDistinctUserCount(carbon.getQuerySpec(None, None, self.weekago + timedelta(weeks = -1), self.now)), len(self.testUsers))
def testFilteredDistinctUserCount(self): # Now, move all the sections before a week # Now there should be no matches in the last week for section in self.SectionsColl.find(): section['section_start_datetime'] = self.weekago + timedelta( days=-1) section['section_end_datetime'] = self.weekago + timedelta( days=-1) + timedelta(hours=1) # print("Section start = %s, section end = %s" % # (section['section_start_datetime'], section['section_end_datetime'])) self.SectionsColl.save(section) print "About to check for distinct users from a week ago" self.assertEqual( carbon.getDistinctUserCount( carbon.getQuerySpec(None, None, self.weekago, self.now)), 0) self.assertEqual( carbon.getDistinctUserCount( carbon.getQuerySpec(None, None, self.weekago + timedelta(weeks=-1), self.now)), len(self.testUsers))
def testDistinctUserCount(self): self.assertEqual(carbon.getDistinctUserCount({}), len(self.testUsers))