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.

25 lines
919 B

  1. from hc.api.models import Channel
  2. from hc.test import BaseTestCase
  3. class AddMattermostTestCase(BaseTestCase):
  4. def setUp(self):
  5. super(AddMattermostTestCase, self).setUp()
  6. self.url = "/projects/%s/add_mattermost/" % self.project.code
  7. def test_instructions_work(self):
  8. self.client.login(username="[email protected]", password="password")
  9. r = self.client.get(self.url)
  10. self.assertContains(r, "Integration Settings", status_code=200)
  11. def test_it_works(self):
  12. form = {"value": "http://example.org"}
  13. self.client.login(username="[email protected]", password="password")
  14. r = self.client.post(self.url, form)
  15. self.assertRedirects(r, self.channels_url)
  16. c = Channel.objects.get()
  17. self.assertEqual(c.kind, "mattermost")
  18. self.assertEqual(c.value, "http://example.org")
  19. self.assertEqual(c.project, self.project)