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
693 B

  1. from hc.api.models import Check
  2. from hc.test import BaseTestCase
  3. class AddCheckTestCase(BaseTestCase):
  4. def test_it_works(self):
  5. url = "/checks/add/"
  6. self.client.login(username="[email protected]", password="password")
  7. r = self.client.post(url)
  8. self.assertRedirects(r, "/checks/")
  9. assert Check.objects.count() == 1
  10. def test_team_access_works(self):
  11. url = "/checks/add/"
  12. self.client.login(username="[email protected]", password="password")
  13. self.client.post(url)
  14. check = Check.objects.get()
  15. # Added by bob, but should belong to alice (bob has team access)
  16. self.assertEqual(check.user, self.alice)