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

  1. from hc.api.models import Check
  2. from hc.test import BaseTestCase
  3. class CopyCheckTestCase(BaseTestCase):
  4. def setUp(self):
  5. super(CopyCheckTestCase, self).setUp()
  6. self.check = Check(project=self.project)
  7. self.check.name = "Foo"
  8. self.check.save()
  9. self.copy_url = "/checks/%s/copy/" % self.check.code
  10. def test_it_works(self):
  11. self.client.login(username="[email protected]", password="password")
  12. r = self.client.post(self.copy_url, follow=True)
  13. self.assertContains(r, "This is a brand new check")
  14. self.assertContains(r, "Foo (copy)")
  15. def test_it_obeys_limit(self):
  16. self.profile.check_limit = 0
  17. self.profile.save()
  18. self.client.login(username="[email protected]", password="password")
  19. r = self.client.post(self.copy_url)
  20. self.assertEqual(r.status_code, 400)