def test_dealer_no_create_pendingeventtoken(self): """ Check token creation by the dealer when it is not needed """ cron_ten_minutes.send(self, counter=1000) self.assertEquals(PendingEventToken.objects.count(), 0)
def test_dealer_create_pendingeventtoken(self): """ Check token creation by the dealer when it is needed """ self.c.available_kingdoms.add(self.k) cron_ten_minutes.send(self, counter=1000) self.assertEquals(PendingEventToken.objects.count(), 1)
def test_recurring_cron(self): """ Test recurring runs within the cron signal """ r = Recurring( delay=10, on_fire=""" kingdom.money = 500 kingdom.save() """ ) r.save() # Sanity check self.assertEqual(Kingdom.objects.get(pk=self.k.pk).money, 0) cron_ten_minutes.send(self, counter=5) self.assertEqual(Kingdom.objects.get(pk=self.k.pk).money, 0) cron_ten_minutes.send(self, counter=10) self.assertEqual(Kingdom.objects.get(pk=self.k.pk).money, 500)