def test_time_remaining_one_message(self): # if there are any messages at all, should still return a True value for the template batch = BatchFactory(status=Batch.PENDING) BulkMessageFactory(batch=batch, sms=None) # using assertTrue because the key is that we want the return value to be boolean True # for the template to NOT display the 'Finished' default self.assertTrue(batch.time_remaining())
def test_time_remaining(self): batch = BatchFactory(status=Batch.PENDING) [ BulkMessageFactory(deleted=True, batch=batch, sms=None) for i in range(5) ] msgs = [BulkMessageFactory(batch=batch, sms=None) for i in range(10)] self.assertEqual(batch.time_remaining(), datetime.timedelta(seconds=len(msgs) / 2))
def test_time_remaining_zero_messages(self): batch = BatchFactory(status=Batch.PENDING) self.assertEqual(batch.time_remaining(), 0)
def test_time_remaining(self): batch = BatchFactory(status=Batch.PENDING) [BulkMessageFactory(deleted=True, batch=batch, sms=None) for i in range(5)] msgs = [BulkMessageFactory(batch=batch, sms=None) for i in range(10)] self.assertEqual(batch.time_remaining(), datetime.timedelta(seconds=len(msgs) / 2))