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.
 
 
 
 
 

21 lines
687 B

from hc.api.models import Check, Ping
from hc.test import BaseTestCase
class LastPingTestCase(BaseTestCase):
def test_it_works(self):
check = Check(user=self.alice)
check.last_ping_body = "this is body"
check.save()
Ping.objects.create(owner=check)
self.client.login(username="[email protected]", password="password")
r = self.client.post("/checks/%s/last_ping/" % check.code)
self.assertContains(r, "this is body", status_code=200)
def test_it_requires_user(self):
check = Check.objects.create()
r = self.client.post("/checks/%s/last_ping/" % check.code)
self.assertEqual(r.status_code, 403)