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.

31 lines
1022 B

8 years ago
  1. from hc.api.models import Channel
  2. from hc.test import BaseTestCase
  3. class AddOpsGenieTestCase(BaseTestCase):
  4. url = "/integrations/add_opsgenie/"
  5. def test_instructions_work(self):
  6. self.client.login(username="[email protected]", password="password")
  7. r = self.client.get(self.url)
  8. self.assertContains(r, "escalation policies and incident tracking")
  9. def test_it_works(self):
  10. form = {"value": "123456"}
  11. self.client.login(username="[email protected]", password="password")
  12. r = self.client.post(self.url, form)
  13. self.assertRedirects(r, "/integrations/")
  14. c = Channel.objects.get()
  15. self.assertEqual(c.kind, "opsgenie")
  16. self.assertEqual(c.value, "123456")
  17. def test_it_trims_whitespace(self):
  18. form = {"value": " 123456 "}
  19. self.client.login(username="[email protected]", password="password")
  20. self.client.post(self.url, form)
  21. c = Channel.objects.get()
  22. self.assertEqual(c.value, "123456")