예제 #1
0
 def test_send_stale_notifications(self, mock_mail):
     msg = notifications.send_stale_notifications()
     self.assertTrue(mock_mail.call_count == 1)
     self.assertTrue('Found' in msg)
     msg = notifications.send_stale_notifications(add_email=['*****@*****.**',
                                                             '*****@*****.**'])
     self.assertTrue(mock_mail.call_count == 2)
     self.assertTrue('Found' in msg)
     n = Notification.objects.first()
     n.timestamp = timezone.now()
     n.save()
     notifications.send_stale_notifications()
     self.assertTrue(mock_mail.call_count == 2)
예제 #2
0
 def test_send_stale_notifications(self, mock_mail):
     msg = notifications.send_stale_notifications()
     self.assertTrue(mock_mail.call_count == 1)
     self.assertTrue('Found' in msg)
     msg = notifications.send_stale_notifications(add_email=['*****@*****.**',
                                                             '*****@*****.**'])
     self.assertTrue(mock_mail.call_count == 2)
     self.assertTrue('Found' in msg)
     n = Notification.objects.first()
     n.timestamp = timezone.now()
     n.save()
     notifications.send_stale_notifications()
     self.assertTrue(mock_mail.call_count == 2)
 def handle(self, *args, **options):
     if options['add_email']:
         msg = send_stale_notifications(add_email=options['add_email'])
     else:
         msg = send_stale_notifications()
     self.stdout.write(msg)
 def handle(self, *args, **options):
     if options["add_email"]:
         msg = send_stale_notifications(add_email=options["add_email"])
     else:
         msg = send_stale_notifications()
     self.stdout.write(msg)