def test_birthday_reminders(self): today = date.today() tomorrow = today + timedelta(days=1) profile = Profile.objects.get(user__username=settings.TEST_USERNAME) profile.actual_date_of_birth = tomorrow profile.save() assert len(mail.outbox) == 0 from greetings.jobs.daily.birthday_reminders import Job job = Job() job.execute() assert len(mail.outbox) == 1 assert profile.register_number in mail.outbox[0].body
def test_birthday_greetings(self): today = date.today() profile = Profile.objects.get(user__username=settings.TEST_USERNAME) profile.actual_date_of_birth = today profile.save() assert len(mail.outbox) == 0 from greetings.jobs.daily.birthday_greetings import Job job = Job() job.execute() assert len(mail.outbox) == 1 assert 'Happy Birthday' in mail.outbox[0].body assert profile.college_email_id in mail.outbox[0].to