def test_mmo_user_total_count_updates_monolith(self, record): UserProfile.objects.create(source=amo.LOGIN_SOURCE_MMO_BROWSERID) job = 'mmo_user_count_total' tasks.update_global_totals(job, datetime.date.today()) self.assertTrue(record.called) eq_(record.call_args[1]['value'], '{"count": 1}')
def test_mmo_user_total_count_updates_monolith(self, record): date = datetime.date(2013, 3, 11) job = 'mmo_user_count_total' tasks.update_global_totals(job, date) self.assertTrue(record.called) eq_(record.call_args[1]['value'], '{"count": 0}')
def test_stats_for_date(self): date = "2009-06-01" job = "addon_total_downloads" eq_(GlobalStat.objects.no_cache().filter(date=date, name=job).count(), 0) tasks.update_global_totals(job, date) eq_(len(GlobalStat.objects.no_cache().filter(date=date, name=job)), 1)
def test_stats_for_date(self): date = '2009-06-01' job = 'addon_total_downloads' eq_(GlobalStat.objects.no_cache().filter(date=date, name=job).count(), 0) tasks.update_global_totals(job, date) eq_(len(GlobalStat.objects.no_cache().filter(date=date, name=job)), 1)
def test_stats_for_date(self): date = datetime.date(2009, 6, 1) job = 'addon_total_downloads' eq_(GlobalStat.objects.no_cache().filter(date=date, name=job).count(), 0) tasks.update_global_totals(job, date) eq_(len(GlobalStat.objects.no_cache().filter(date=date, name=job)), 1)
def test_addon_total_downloads_doesnot_update_monolith(self, record): date = datetime.date(2013, 3, 11) job = 'addon_total_downloads' tasks.update_global_totals(job, date) self.assertFalse(record.called)
def test_user_total_count_updates_monolith(self, record): date = datetime.date(2013, 3, 11) job = 'user_count_total' tasks.update_global_totals(job, date) assert record.called
def test_user_total_count_updates_monolith(self): date = datetime.date(2013, 3, 11) job = 'user_count_total' tasks.update_global_totals(job, date) eq_(MonolithRecord.objects.count(), 1)