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

  1. from hc.api.models import Check, Ping
  2. from hc.test import BaseTestCase
  3. class LastPingTestCase(BaseTestCase):
  4. def test_it_works(self):
  5. check = Check(user=self.alice)
  6. check.last_ping_body = "this is body"
  7. check.save()
  8. Ping.objects.create(owner=check)
  9. self.client.login(username="[email protected]", password="password")
  10. r = self.client.post("/checks/%s/last_ping/" % check.code)
  11. self.assertContains(r, "this is body", status_code=200)
  12. def test_it_requires_user(self):
  13. check = Check.objects.create()
  14. r = self.client.post("/checks/%s/last_ping/" % check.code)
  15. self.assertEqual(r.status_code, 403)