Browse Source

Fix tests.

pull/109/head
Pēteris Caune 8 years ago
parent
commit
5a4c3ce8ea
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      hc/api/models.py
  2. +2
    -2
      hc/api/tests/test_check_model.py

+ 1
- 1
hc/api/models.py View File

@ -97,7 +97,7 @@ class Check(models.Model):
""" Return the datetime when grace period starts. """
# The common case, grace starts after timeout
if not self.schedule:
if self.kind == "simple":
return self.last_ping + self.timeout
# The complex case, next ping is expected based on cron schedule


+ 2
- 2
hc/api/tests/test_check_model.py View File

@ -43,7 +43,7 @@ class CheckModelTestCase(TestCase):
# Expect ping every midnight, default grace is 1 hour
check = Check()
check.timeout = timedelta(minutes=0)
check.kind = "cron"
check.schedule = "0 0 * * *"
check.status = "up"
check.last_ping = dt
@ -61,7 +61,7 @@ class CheckModelTestCase(TestCase):
# Expect ping every day at 10am, default grace is 1 hour
check = Check()
check.timeout = timedelta(minutes=0)
check.kind = "cron"
check.schedule = "0 10 * * *"
check.status = "up"
check.last_ping = dt


Loading…
Cancel
Save