Пример #1
0
 def test_log_clean_deletes(self):
     week_ago = (now() - timedelta(days=7)).date()
     months_ago = (now() - timedelta(days=60)).date()
     b1 = BugmailStat.objects.create(stat_type=BugmailStat.TOTAL, count=5, date=week_ago)
     BugmailStat.objects.create(stat_type=BugmailStat.TOTAL, count=5, date=months_ago)
     eq_(BugmailStat.objects.count(), 2)
     bm_tasks.clean_bugmail_log()
     eq_(BugmailStat.objects.count(), 1)
     eq_(BugmailStat.objects.all()[0], b1)
Пример #2
0
 def test_log_clean_deletes(self):
     week_ago = (now() - timedelta(days=7)).date()
     months_ago = (now() - timedelta(days=60)).date()
     b1 = BugmailStat.objects.create(stat_type=BugmailStat.TOTAL,
                                     count=5,
                                     date=week_ago)
     BugmailStat.objects.create(stat_type=BugmailStat.TOTAL,
                                count=5,
                                date=months_ago)
     eq_(BugmailStat.objects.count(), 2)
     bm_tasks.clean_bugmail_log()
     eq_(BugmailStat.objects.count(), 1)
     eq_(BugmailStat.objects.all()[0], b1)
Пример #3
0
def clean_bugmails():
    """Cron version of the periodic celery task."""
    clean_bugmail_log()