forked from GithubBackups/healthchecks
Update Webhook unit tests to use added Content-Type value.
This commit is contained in:
parent
0ea5927b6a
commit
fdf011aa25
@ -18,7 +18,7 @@ class AddWebhookTestCase(BaseTestCase):
|
|||||||
self.assertRedirects(r, "/integrations/")
|
self.assertRedirects(r, "/integrations/")
|
||||||
|
|
||||||
c = Channel.objects.get()
|
c = Channel.objects.get()
|
||||||
self.assertEqual(c.value, "http://foo.com\nhttps://bar.com\n")
|
self.assertEqual(c.value, "http://foo.com\nhttps://bar.com\n\n")
|
||||||
|
|
||||||
def test_it_adds_webhook_using_team_access(self):
|
def test_it_adds_webhook_using_team_access(self):
|
||||||
form = {"value_down": "http://foo.com", "value_up": "https://bar.com"}
|
form = {"value_down": "http://foo.com", "value_up": "https://bar.com"}
|
||||||
@ -30,7 +30,7 @@ class AddWebhookTestCase(BaseTestCase):
|
|||||||
|
|
||||||
c = Channel.objects.get()
|
c = Channel.objects.get()
|
||||||
self.assertEqual(c.user, self.alice)
|
self.assertEqual(c.user, self.alice)
|
||||||
self.assertEqual(c.value, "http://foo.com\nhttps://bar.com\n")
|
self.assertEqual(c.value, "http://foo.com\nhttps://bar.com\n\n")
|
||||||
|
|
||||||
def test_it_rejects_bad_urls(self):
|
def test_it_rejects_bad_urls(self):
|
||||||
urls = [
|
urls = [
|
||||||
@ -59,7 +59,7 @@ class AddWebhookTestCase(BaseTestCase):
|
|||||||
self.client.post(self.url, form)
|
self.client.post(self.url, form)
|
||||||
|
|
||||||
c = Channel.objects.get()
|
c = Channel.objects.get()
|
||||||
self.assertEqual(c.value, "\nhttp://foo.com\n")
|
self.assertEqual(c.value, "\nhttp://foo.com\n\n")
|
||||||
|
|
||||||
def test_it_adds_post_data(self):
|
def test_it_adds_post_data(self):
|
||||||
form = {"value_down": "http://foo.com", "post_data": "hello"}
|
form = {"value_down": "http://foo.com", "post_data": "hello"}
|
||||||
@ -69,4 +69,14 @@ class AddWebhookTestCase(BaseTestCase):
|
|||||||
self.assertRedirects(r, "/integrations/")
|
self.assertRedirects(r, "/integrations/")
|
||||||
|
|
||||||
c = Channel.objects.get()
|
c = Channel.objects.get()
|
||||||
self.assertEqual(c.value, "http://foo.com\n\nhello")
|
self.assertEqual(c.value, "http://foo.com\n\nhello\n")
|
||||||
|
|
||||||
|
def test_it_adds_content_type(self):
|
||||||
|
form = {"value_down": "http://foo.com", "post_data": "hello", "content_type": "application/json"}
|
||||||
|
|
||||||
|
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.value, "http://foo.com\n\nhello\napplication/json")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user