|
@ -31,7 +31,7 @@ class UpdateTimeoutTestCase(BaseTestCase): |
|
|
url = "/checks/%s/timeout/" % self.check.code |
|
|
url = "/checks/%s/timeout/" % self.check.code |
|
|
payload = { |
|
|
payload = { |
|
|
"kind": "cron", |
|
|
"kind": "cron", |
|
|
"schedule": "* * * * *", |
|
|
|
|
|
|
|
|
"schedule": "5 * * * *", |
|
|
"tz": "UTC", |
|
|
"tz": "UTC", |
|
|
"timeout": 60, |
|
|
"timeout": 60, |
|
|
"grace": 60 |
|
|
"grace": 60 |
|
@ -43,7 +43,28 @@ class UpdateTimeoutTestCase(BaseTestCase): |
|
|
|
|
|
|
|
|
self.check.refresh_from_db() |
|
|
self.check.refresh_from_db() |
|
|
self.assertEqual(self.check.kind, "cron") |
|
|
self.assertEqual(self.check.kind, "cron") |
|
|
self.assertEqual(self.check.schedule, "* * * * *") |
|
|
|
|
|
|
|
|
self.assertEqual(self.check.schedule, "5 * * * *") |
|
|
|
|
|
|
|
|
|
|
|
def test_it_validates_cron_expression(self): |
|
|
|
|
|
self.check.last_ping = None |
|
|
|
|
|
self.check.save() |
|
|
|
|
|
|
|
|
|
|
|
url = "/checks/%s/timeout/" % self.check.code |
|
|
|
|
|
payload = { |
|
|
|
|
|
"kind": "cron", |
|
|
|
|
|
"schedule": "* invalid *", |
|
|
|
|
|
"tz": "UTC", |
|
|
|
|
|
"timeout": 60, |
|
|
|
|
|
"grace": 60 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
|
|
r = self.client.post(url, data=payload) |
|
|
|
|
|
self.assertRedirects(r, "/checks/") |
|
|
|
|
|
|
|
|
|
|
|
# Check should still have its original data: |
|
|
|
|
|
self.check.refresh_from_db() |
|
|
|
|
|
self.assertEqual(self.check.kind, "simple") |
|
|
|
|
|
|
|
|
def test_team_access_works(self): |
|
|
def test_team_access_works(self): |
|
|
url = "/checks/%s/timeout/" % self.check.code |
|
|
url = "/checks/%s/timeout/" % self.check.code |
|
|