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.

34 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 = {"settings": json.dumps({
  15. "token": "fake-token",
  16. "board_name": "My Board",
  17. "list_name": "My List",
  18. "list_id": "fake-list-id"
  19. })}
  20. self.client.login(username="[email protected]", password="password")
  21. r = self.client.post(self.url, form)
  22. self.assertRedirects(r, "/integrations/")
  23. c = Channel.objects.get()
  24. self.assertEqual(c.kind, "trello")
  25. self.assertEqual(c.trello_token, "fake-token")
  26. self.assertEqual(c.user, self.alice)
  27. self.assertEqual(c.project, self.project)