|
@ -128,22 +128,11 @@ class PingTestCase(TestCase): |
|
|
self.check.refresh_from_db() |
|
|
self.check.refresh_from_db() |
|
|
self.assertTrue(self.check.has_confirmation_link) |
|
|
self.assertTrue(self.check.has_confirmation_link) |
|
|
|
|
|
|
|
|
def test_ping_resets_fail_flag(self): |
|
|
|
|
|
self.check.last_ping_was_fail = True |
|
|
|
|
|
self.check.save() |
|
|
|
|
|
|
|
|
|
|
|
r = self.client.get("/ping/%s/" % self.check.code) |
|
|
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
|
|
|
|
self.check.refresh_from_db() |
|
|
|
|
|
self.assertFalse(self.check.last_ping_was_fail) |
|
|
|
|
|
|
|
|
|
|
|
def test_fail_endpoint_works(self): |
|
|
def test_fail_endpoint_works(self): |
|
|
r = self.client.get("/ping/%s/fail" % self.check.code) |
|
|
r = self.client.get("/ping/%s/fail" % self.check.code) |
|
|
self.assertEqual(r.status_code, 200) |
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
|
self.check.refresh_from_db() |
|
|
self.check.refresh_from_db() |
|
|
self.assertTrue(self.check.last_ping_was_fail) |
|
|
|
|
|
self.assertEqual(self.check.status, "down") |
|
|
self.assertEqual(self.check.status, "down") |
|
|
self.assertEqual(self.check.alert_after, None) |
|
|
self.assertEqual(self.check.alert_after, None) |
|
|
|
|
|
|
|
|