You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
824 B

from hc.api.models import Check
from hc.test import BaseTestCase
class PauseTestCase(BaseTestCase):
def setUp(self):
super(PauseTestCase, self).setUp()
self.check = Check(user=self.alice, status="up")
self.check.save()
def test_it_pauses(self):
url = "/checks/%s/pause/" % self.check.code
self.client.login(username="[email protected]", password="password")
r = self.client.post(url)
self.assertRedirects(r, "/checks/")
self.check.refresh_from_db()
self.assertEqual(self.check.status, "paused")
def test_it_rejects_get(self):
url = "/checks/%s/pause/" % self.check.code
self.client.login(username="[email protected]", password="password")
r = self.client.get(url)
self.assertEqual(r.status_code, 405)