From 5a4c3ce8eaa6e3aa56b7d6959e9c5320c2df830f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Tue, 13 Dec 2016 21:37:29 +0200 Subject: [PATCH] Fix tests. --- hc/api/models.py | 2 +- hc/api/tests/test_check_model.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hc/api/models.py b/hc/api/models.py index 17d422fe..ee702b8f 100644 --- a/hc/api/models.py +++ b/hc/api/models.py @@ -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 diff --git a/hc/api/tests/test_check_model.py b/hc/api/tests/test_check_model.py index 6eb0b736..ad347558 100644 --- a/hc/api/tests/test_check_model.py +++ b/hc/api/tests/test_check_model.py @@ -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