Don't update last_ping_was_fail, it is not read anywhere anymore.

This commit is contained in:
Pēteris Caune 2018-12-21 13:17:00 +02:00
parent cc40793fc7
commit fe04429fad
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 0 additions and 12 deletions

View File

@ -227,7 +227,6 @@ class Check(models.Model):
else:
self.last_start = None
self.last_ping = timezone.now()
self.last_ping_was_fail = action == "fail"
new_status = "down" if action == "fail" else "up"
if self.status != new_status:

View File

@ -128,22 +128,11 @@ class PingTestCase(TestCase):
self.check.refresh_from_db()
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):
r = self.client.get("/ping/%s/fail" % self.check.code)
self.assertEqual(r.status_code, 200)
self.check.refresh_from_db()
self.assertTrue(self.check.last_ping_was_fail)
self.assertEqual(self.check.status, "down")
self.assertEqual(self.check.alert_after, None)