def test_it_sends_nag(self): cmd = Command() cmd.stdout = Mock() # silence output to stdout cmd.pause = Mock() # don't pause for 1s found = cmd.handle_one_nag() self.assertTrue(found) self.profile.refresh_from_db() self.assertTrue(self.profile.next_nag_date > now()) self.assertEqual(len(mail.outbox), 1)
def test_it_sends_report(self): cmd = Command() cmd.stdout = Mock() # silence output to stdout cmd.pause = Mock() # don't pause for 1s found = cmd.handle_one_monthly_report() self.assertTrue(found) self.profile.refresh_from_db() self.assertTrue(self.profile.next_report_date > now()) self.assertEqual(len(mail.outbox), 1) email = mail.outbox[0] self.assertTrue("List-Unsubscribe" in email.extra_headers)