def test_it_works(self): p = Ping(owner=self.check) p.created = now() p.save() n = Notification.objects.create(owner=self.check, channel=self.channel) n.created = p.created - td(minutes=1) n.save() output = Command().handle() self.assertIn("Pruned 1 notifications", output) self.assertFalse(Notification.objects.exists())
def setUp(self): super(LogTestCase, self).setUp() self.check = Check(user=self.alice) self.check.save() ping = Ping(owner=self.check) ping.save() # Older MySQL versions don't store microseconds. This makes sure # the ping is older than any notifications we may create later: ping.created = "2000-01-01T00:00:00+00:00" ping.save()