示例#1
0
 def test_reminder_from_emails(self):
     """"Test the logic that determines the return address for emails."""
     first, reminder = self.test_reminders_get_added()
     reminder.due = datetime.now()
     reminder.reminder.from_address = ""
     reminder.save()
     reminder.reminder.save()
     send_reminders_due_now()
         
     # expect it to come from the studyadmin because nothing set for the reminder
     assert mail.outbox[0].from_email == "*****@*****.**"
示例#2
0
    def test_reminder_from_emails(self):
        """"Test the logic that determines the return address for emails."""
        first, reminder = self.test_reminders_get_added()
        reminder.due = datetime.now()
        reminder.reminder.from_address = ""
        reminder.save()
        reminder.reminder.save()
        send_reminders_due_now()

        # expect it to come from the studyadmin because nothing set for the reminder
        assert mail.outbox[0].from_email == "*****@*****.**"
示例#3
0
    def test_reminder_is_sent(self):

        first, reminder = self.test_reminders_get_added()

        send_reminders_due_now()
        assert len(mail.outbox) == 0  # nothing sent

        reminder.due = datetime.now()  # fiddle the time
        reminder.save()
        send_reminders_due_now()
        assert len(mail.outbox) == 1  # has been sent now

        send_reminders_due_now()
        assert len(mail.outbox) == 1  # not resent again
        
        # it comes from the right address
        assert mail.outbox[0].from_email == "*****@*****.**"
示例#4
0
    def test_reminder_is_sent(self):

        first, reminder = self.test_reminders_get_added()

        send_reminders_due_now()
        assert len(mail.outbox) == 0  # nothing sent

        reminder.due = datetime.now()  # fiddle the time
        reminder.save()
        send_reminders_due_now()
        assert len(mail.outbox) == 1  # has been sent now

        send_reminders_due_now()
        assert len(mail.outbox) == 1  # not resent again

        # it comes from the right address
        assert mail.outbox[0].from_email == "*****@*****.**"
示例#5
0
 def handle(self, *args, **options):
     reminderlistresult = send_reminders_due_now()
     self.stdout.write("{}".format([i.id for i, j in reminderlistresult]))