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.

37 lines
1.1 KiB

  1. import json
  2. from django.test.utils import override_settings
  3. from hc.api.models import Channel
  4. from hc.test import BaseTestCase
  5. class AddPagerTreeTestCase(BaseTestCase):
  6. url = "/integrations/add_trello/"
  7. @override_settings(TRELLO_APP_KEY="foo")
  8. def test_instructions_work(self):
  9. self.client.login(username="[email protected]", password="password")
  10. r = self.client.get(self.url)
  11. self.assertContains(r, "Trello")
  12. @override_settings(TRELLO_APP_KEY="foo")
  13. def test_it_works(self):
  14. form = {
  15. "settings": json.dumps(
  16. {
  17. "token": "fake-token",
  18. "board_name": "My Board",
  19. "list_name": "My List",
  20. "list_id": "fake-list-id",
  21. }
  22. )
  23. }
  24. self.client.login(username="[email protected]", password="password")
  25. r = self.client.post(self.url, form)
  26. self.assertRedirects(r, "/integrations/")
  27. c = Channel.objects.get()
  28. self.assertEqual(c.kind, "trello")
  29. self.assertEqual(c.trello_token, "fake-token")
  30. self.assertEqual(c.project, self.project)