Beispiel #1
0
 def test_active_batches(self):
     BatchFactory(status=Batch.PENDING, deleted=True)
     batch = BatchFactory(status=Batch.PENDING)
     self.assertEqual(Batch.objects.get_next_batch(), None)
     batch.status = Batch.APPROVED
     batch.save()
     self.assertEqual(Batch.objects.get_next_batch(), batch)
     batch.status = Batch.REJECTED
     batch.save()
     self.assertEqual(Batch.objects.get_next_batch(), None)
     batch.status = Batch.COMPLETED
     batch.save()
     self.assertEqual(Batch.objects.get_next_batch(), None)
Beispiel #2
0
 def test_active_batches(self):
     BatchFactory(status=Batch.PENDING, deleted=True)
     batch = BatchFactory(status=Batch.PENDING)
     self.assertEqual(Batch.objects.get_next_batch(), None)
     batch.status = Batch.APPROVED
     batch.save()
     self.assertEqual(Batch.objects.get_next_batch(), batch)
     batch.status = Batch.REJECTED
     batch.save()
     self.assertEqual(Batch.objects.get_next_batch(), None)
     batch.status = Batch.COMPLETED
     batch.save()
     self.assertEqual(Batch.objects.get_next_batch(), None)
Beispiel #3
0
 def test_multiple_active_batches(self):
     # Our code should use the highest priority batch
     batch1 = BatchFactory(status=Batch.APPROVED, priority=5)
     batch2 = BatchFactory(status=Batch.APPROVED, priority=2)
     BatchFactory(status=Batch.PENDING, deleted=True)
     self.assertEqual(Batch.objects.get_next_batch(), batch1)
     # dealing with batch1 will then make batch2 the highest priority one
     batch1.status = Batch.REJECTED
     batch1.save()
     self.assertEqual(Batch.objects.get_next_batch(), batch2)
Beispiel #4
0
 def test_multiple_active_batches(self):
     # Our code should use the highest priority batch
     batch1 = BatchFactory(status=Batch.APPROVED, priority=5)
     batch2 = BatchFactory(status=Batch.APPROVED, priority=2)
     BatchFactory(status=Batch.PENDING, deleted=True)
     self.assertEqual(Batch.objects.get_next_batch(), batch1)
     # dealing with batch1 will then make batch2 the highest priority one
     batch1.status = Batch.REJECTED
     batch1.save()
     self.assertEqual(Batch.objects.get_next_batch(), batch2)