|
|
@ -1,5 +1,7 @@ |
|
|
|
from django.test import TestCase |
|
|
|
from datetime import timedelta |
|
|
|
|
|
|
|
from django.test import TestCase |
|
|
|
from django.utils import timezone |
|
|
|
from hc.api.models import Check |
|
|
|
|
|
|
|
|
|
|
@ -17,3 +19,11 @@ class CheckModelTestCase(TestCase): |
|
|
|
def test_in_grace_period_handles_new_check(self): |
|
|
|
check = Check() |
|
|
|
self.assertFalse(check.in_grace_period()) |
|
|
|
|
|
|
|
def test_status_works_with_grace_period(self): |
|
|
|
check = Check() |
|
|
|
check.status = "up" |
|
|
|
check.last_ping = timezone.now() - timedelta(days=1, minutes=30) |
|
|
|
|
|
|
|
self.assertTrue(check.in_grace_period()) |
|
|
|
self.assertEqual(check.get_status(), "up") |