Пример #1
0
 def audited_sms_test(self):
     # messages that created a discrepancy once will not create
     # a new one when the auditor is run again
     audit_sms.delay()
     discrepancies = models.Discrepancy.objects.all()
     self.assertEqual(discrepancies.count(), 5)
     # auditor second run
     audit_sms.delay()
     discrepancies = models.Discrepancy.objects.all()
     self.assertEqual(discrepancies.count(), 5)
Пример #2
0
 def audited_sms_test(self):
     # messages that created a discrepancy once will not create
     # a new one when the auditor is run again
     audit_sms.delay()
     discrepancies = models.Discrepancy.objects.all()
     self.assertEqual(discrepancies.count(), 5)
     # auditor second run
     audit_sms.delay()
     discrepancies = models.Discrepancy.objects.all()
     self.assertEqual(discrepancies.count(), 5)
Пример #3
0
 def notifications_sent_test(self):
     # subscribers should be notified about discrepancies
     audit_sms.delay()
     # discrepancies found (5)
     # send email to each of the 3 subscribers
     self.assertEqual(len(mail.outbox), 3)
     # auditor second run
     audit_sms.delay()
     # no new discrepancies found
     # no new emails added to the outbox
     self.assertEqual(len(mail.outbox), 3)
Пример #4
0
 def notifications_sent_test(self):
     # subscribers should be notified about discrepancies
     audit_sms.delay()
     # discrepancies found (5)
     # send email to each of the 3 subscribers
     self.assertEqual(len(mail.outbox), 3)
     # auditor second run
     audit_sms.delay()
     # no new discrepancies found
     # no new emails added to the outbox
     self.assertEqual(len(mail.outbox), 3)
Пример #5
0
 def only_audit_old_sms_test(self):
     # mark all SMS and VumiLog instances in the db as audited
     models.VumiLog.objects.update(is_audited=True)
     SMS.objects.update(is_audited=True)
     outgoing = OUTGOING
     # create new SMS
     self.create_batch(SMSFactory, 3, direction=outgoing, start=10, carrier=self.vumi_backend)
     audit_sms.delay()
     discrepancies = models.Discrepancy.objects.all()
     # SMS created within the last 24 hours will not be audited and should
     # not create any new discrepancies.
     self.assertEqual(discrepancies.count(), 0)
Пример #6
0
 def only_audit_old_sms_test(self):
     # mark all SMS and VumiLog instances in the db as audited
     models.VumiLog.objects.update(is_audited=True)
     SMS.objects.update(is_audited=True)
     outgoing = OUTGOING
     # create new SMS
     self.create_batch(SMSFactory,
                       3,
                       direction=outgoing,
                       start=10,
                       carrier=self.vumi_backend)
     audit_sms.delay()
     discrepancies = models.Discrepancy.objects.all()
     # SMS created within the last 24 hours will not be audited and should
     # not create any new discrepancies.
     self.assertEqual(discrepancies.count(), 0)