Beispiel #1
0
 def test_notification_not_set_when_not_stale(self):
     """ Test that email is not sent, if 14 days hasn't passed"""
     mommy.make(
         "Invoice",
         campaign=testing_campaign,
         company=self.company,
         sequence_number=None,
         campaign__phase_set=[testing_campaign().phase("competition")],
         last_sync_time=datetime.datetime(2017, 5, 9, 12, 0, 0),
     )
     mail.outbox = []
     mail_count = tasks.send_unpaid_invoice_notification(campaign_slug=testing_campaign().slug)
     self.assertEqual(mail_count, 0)
Beispiel #2
0
 def test_notification(self):
     """ Test that email is sent, if the invoice hasn't been paid in 14 days """
     mommy.make(
         "Invoice",
         campaign=testing_campaign,
         company=self.company,
         sequence_number=None,
         campaign__phase_set=[testing_campaign().phase("competition")],
         last_sync_time=datetime.datetime(2017, 5, 1, 12, 0, 0),
     )
     mail.outbox = []
     mail_count = tasks.send_unpaid_invoice_notification(campaign_slug=testing_campaign().slug)
     self.assertEqual(mail_count, 1)
     self.assertEqual(len(mail.outbox), 1)
     msg = mail.outbox[0]
     self.assertEqual(msg.recipients(), ['*****@*****.**'])
     self.assertEqual(str(mail.outbox[0].subject), "Testing campaign - připomenutí nezaplacené faktury")
Beispiel #3
0
 def test_english_notification(self):
     """ Test that email is sent, if the invoice hasn't been paid in 14 days """
     mommy.make(
         "Invoice",
         campaign=testing_campaign,
         company=self.company,
         sequence_number=None,
         campaign__phase_set=[testing_campaign().phase("competition")],
         last_sync_time=datetime.datetime(2017, 5, 1, 12, 0, 0),
     )
     self.user_attendance.userprofile.language = "en"
     self.user_attendance.userprofile.save()
     mail.outbox = []
     mail_count = tasks.send_unpaid_invoice_notification(campaign_slug=testing_campaign().slug)
     self.assertEqual(mail_count, 1)
     self.assertEqual(len(mail.outbox), 1)
     msg = mail.outbox[0]
     self.assertEqual(msg.recipients(), ['*****@*****.**'])
     self.assertEqual(str(mail.outbox[0].subject), "Testing campaign - reminder about unpaid invoice")