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.

23 lines
779 B

  1. from hc.api.models import Check
  2. from hc.test import BaseTestCase
  3. class DeleteCheckTestCase(BaseTestCase):
  4. def setUp(self):
  5. super(DeleteCheckTestCase, self).setUp()
  6. self.check = Check(user=self.alice)
  7. self.check.save()
  8. def test_it_works(self):
  9. r = self.client.delete("/api/v1/checks/%s" % self.check.code,
  10. HTTP_X_API_KEY="X" * 32)
  11. self.assertEqual(r.status_code, 200)
  12. # It should be gone--
  13. self.assertFalse(Check.objects.filter(code=self.check.code).exists())
  14. def test_it_handles_missing_check(self):
  15. url = "/api/v1/checks/07c2f548-9850-4b27-af5d-6c9dc157ec02"
  16. r = self.client.delete(url, HTTP_X_API_KEY="X" * 32)
  17. self.assertEqual(r.status_code, 404)