forked from GithubBackups/healthchecks
Add pagerteam tests file which had been missed despite its existence
This commit is contained in:
parent
073bcb1f6f
commit
53467bd7d4
30
hc/front/tests/test_add_pagerteam.py
Normal file
30
hc/front/tests/test_add_pagerteam.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
from hc.api.models import Channel
|
||||||
|
from hc.test import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
|
class AddPagerTeamTestCase(BaseTestCase):
|
||||||
|
url = "/integrations/add_pagerteam/"
|
||||||
|
|
||||||
|
def test_instructions_work(self):
|
||||||
|
self.client.login(username="alice@example.org", password="password")
|
||||||
|
r = self.client.get(self.url)
|
||||||
|
self.assertContains(r, "PagerTeam")
|
||||||
|
|
||||||
|
def test_it_works(self):
|
||||||
|
form = {"value": "http://example.org"}
|
||||||
|
|
||||||
|
self.client.login(username="alice@example.org", password="password")
|
||||||
|
r = self.client.post(self.url, form)
|
||||||
|
self.assertRedirects(r, "/integrations/")
|
||||||
|
|
||||||
|
c = Channel.objects.get()
|
||||||
|
self.assertEqual(c.kind, "pagerteam")
|
||||||
|
self.assertEqual(c.value, "http://example.org")
|
||||||
|
self.assertEqual(c.project, self.project)
|
||||||
|
|
||||||
|
def test_it_rejects_bad_url(self):
|
||||||
|
form = {"value": "not an URL"}
|
||||||
|
|
||||||
|
self.client.login(username="alice@example.org", password="password")
|
||||||
|
r = self.client.post(self.url, form)
|
||||||
|
self.assertContains(r, "Enter a valid URL")
|
Loading…
x
Reference in New Issue
Block a user