|
|
@ -8,9 +8,11 @@ class StatusSingleTestCase(BaseTestCase): |
|
|
|
self.check = Check(project=self.project, name="Alice Was Here") |
|
|
|
self.check.save() |
|
|
|
|
|
|
|
self.url = "/checks/%s/status/" % self.check.code |
|
|
|
|
|
|
|
def test_it_works(self): |
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get("/checks/%s/status/" % self.check.code) |
|
|
|
r = self.client.get(self.url) |
|
|
|
doc = r.json() |
|
|
|
|
|
|
|
self.assertEqual(doc["status"], "new") |
|
|
@ -24,7 +26,7 @@ class StatusSingleTestCase(BaseTestCase): |
|
|
|
self.check.save() |
|
|
|
|
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get("/checks/%s/status/" % self.check.code) |
|
|
|
r = self.client.get(self.url) |
|
|
|
doc = r.json() |
|
|
|
|
|
|
|
self.assertEqual(doc["status"], "up") |
|
|
@ -38,7 +40,7 @@ class StatusSingleTestCase(BaseTestCase): |
|
|
|
self.check.save() |
|
|
|
|
|
|
|
timestamp = str(p.created.timestamp()) |
|
|
|
url = "/checks/%s/status/?u=%s" % (self.check.code, timestamp) |
|
|
|
url = self.url + "?u=%s" % timestamp |
|
|
|
|
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get(url) |
|
|
@ -48,7 +50,7 @@ class StatusSingleTestCase(BaseTestCase): |
|
|
|
|
|
|
|
def test_it_allows_cross_team_access(self): |
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get("/checks/%s/status/" % self.check.code) |
|
|
|
r = self.client.get(self.url) |
|
|
|
self.assertEqual(r.status_code, 200) |
|
|
|
|
|
|
|
def test_it_handles_manual_resume(self): |
|
|
@ -57,8 +59,25 @@ class StatusSingleTestCase(BaseTestCase): |
|
|
|
self.check.save() |
|
|
|
|
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get("/checks/%s/status/" % self.check.code) |
|
|
|
r = self.client.get(self.url) |
|
|
|
doc = r.json() |
|
|
|
|
|
|
|
self.assertEqual(doc["status"], "paused") |
|
|
|
self.assertIn("will ignore pings until resumed", doc["status_text"]) |
|
|
|
self.assertIn("resume-btn", doc["status_text"]) |
|
|
|
|
|
|
|
def test_resume_requires_rw_access(self): |
|
|
|
self.bobs_membership.rw = False |
|
|
|
self.bobs_membership.save() |
|
|
|
|
|
|
|
self.check.status = "paused" |
|
|
|
self.check.manual_resume = True |
|
|
|
self.check.save() |
|
|
|
|
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get(self.url) |
|
|
|
doc = r.json() |
|
|
|
|
|
|
|
self.assertEqual(doc["status"], "paused") |
|
|
|
self.assertTrue("will ignore pings until resumed" in doc["status_text"]) |
|
|
|
self.assertIn("will ignore pings until resumed", doc["status_text"]) |
|
|
|
self.assertNotIn("resume-btn", doc["status_text"]) |