forked from GithubBackups/healthchecks
In hc.front.views.ping_details, if a ping does not exist, return 404 instead of 500
This commit is contained in:
parent
ccd30ac239
commit
b0b6ee3149
@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Don't trigger "down" notifications when changing schedule interactively in web UI
|
- Don't trigger "down" notifications when changing schedule interactively in web UI
|
||||||
- Fix sendalerts crash loop when encountering a bad cron schedule
|
- Fix sendalerts crash loop when encountering a bad cron schedule
|
||||||
- Stricter cron validation, reject schedules like "At midnight of February 31"
|
- Stricter cron validation, reject schedules like "At midnight of February 31"
|
||||||
|
- In hc.front.views.ping_details, if a ping does not exist, return 404 instead of 500
|
||||||
|
|
||||||
## v1.12.0 - 2020-01-02
|
## v1.12.0 - 2020-01-02
|
||||||
|
|
||||||
|
@ -52,3 +52,10 @@ class LastPingTestCase(BaseTestCase):
|
|||||||
self.client.login(username="bob@example.org", password="password")
|
self.client.login(username="bob@example.org", password="password")
|
||||||
r = self.client.get("/checks/%s/last_ping/" % check.code)
|
r = self.client.get("/checks/%s/last_ping/" % check.code)
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
|
|
||||||
|
def test_it_handles_missing_ping(self):
|
||||||
|
check = Check.objects.create(project=self.project)
|
||||||
|
|
||||||
|
self.client.login(username="alice@example.org", password="password")
|
||||||
|
r = self.client.get("/checks/%s/pings/123/" % check.code)
|
||||||
|
self.assertEqual(r.status_code, 404)
|
||||||
|
@ -424,7 +424,10 @@ def ping_details(request, code, n=None):
|
|||||||
if n:
|
if n:
|
||||||
q = q.filter(n=n)
|
q = q.filter(n=n)
|
||||||
|
|
||||||
|
try:
|
||||||
ping = q.latest("created")
|
ping = q.latest("created")
|
||||||
|
except Ping.DoesNotExist:
|
||||||
|
raise Http404("not found")
|
||||||
|
|
||||||
ctx = {"check": check, "ping": ping}
|
ctx = {"check": check, "ping": ping}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user