Skip to content

Commit

Permalink
add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
r-wambui committed May 18, 2017
1 parent c9f204b commit 5778aff
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion hc/api/tests/test_sendreports.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,23 @@ def setUp(self):
self.check = Check(user=self.alice, last_ping=now())
self.check.save()

def test_it_sends_report(self):
def test_it_sends_report_monthly(self):
sent = Command().handle_one_run()
self.assertEqual(sent, 1)
# Alice's profile should have been updated
self.profile.refresh_from_db()
self.profile.next_report_date = now() + td(days=30)
self.assertTrue(self.profile.next_report_date > now())

def test_it_sends_report_weekly(self):
sent = Command().handle_one_run()
self.assertEqual(sent, 1)
# Alice's profile should have been updated
self.profile.refresh_from_db()
self.profile.next_report_date = now() + td(days=7)
self.assertTrue(self.profile.next_report_date > now())

def test_it_sends_report_daily(self):
sent = Command().handle_one_run()
self.assertEqual(sent, 1)
# Alice's profile should have been updated
Expand Down

0 comments on commit 5778aff

Please sign in to comment.