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.

29 lines
800 B

  1. from django.contrib.auth.models import User
  2. from django.test import TestCase
  3. from hc.api.models import Check
  4. class LogTestCase(TestCase):
  5. def setUp(self):
  6. self.alice = User(username="alice")
  7. self.alice.set_password("password")
  8. self.alice.save()
  9. self.check = Check(user=self.alice)
  10. self.check.save()
  11. def test_it_works(self):
  12. url = "/checks/%s/log/" % self.check.code
  13. self.client.login(username="alice", password="password")
  14. r = self.client.get(url)
  15. self.assertContains(r, "Log for", status_code=200)
  16. def test_it_handles_bad_uuid(self):
  17. url = "/checks/not-uuid/log/"
  18. self.client.login(username="alice", password="password")
  19. r = self.client.get(url)
  20. assert r.status_code == 400