summaryrefslogtreecommitdiffstats
path: root/api/webhook_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/webhook_test.go')
-rw-r--r--api/webhook_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/api/webhook_test.go b/api/webhook_test.go
index 5198056cc..1b13bb5d4 100644
--- a/api/webhook_test.go
+++ b/api/webhook_test.go
@@ -511,6 +511,7 @@ func TestRegenOutgoingHookToken(t *testing.T) {
t.Fatal("should have errored - webhooks turned off")
}
}
+
func TestIncomingWebhooks(t *testing.T) {
th := Setup().InitSystemAdmin()
Client := th.SystemAdminClient
@@ -529,11 +530,17 @@ func TestIncomingWebhooks(t *testing.T) {
hook = Client.Must(Client.CreateIncomingWebhook(hook)).Data.(*model.IncomingWebhook)
url := "/hooks/" + hook.Id
+ text := `this is a \"test\"
+ that contains a newline and a tab`
if _, err := Client.DoPost(url, "{\"text\":\"this is a test\"}", "application/json"); err != nil {
t.Fatal(err)
}
+ if _, err := Client.DoPost(url, "{\"text\":\""+text+"\"}", "application/json"); err != nil {
+ t.Fatal(err)
+ }
+
if _, err := Client.DoPost(url, fmt.Sprintf("{\"text\":\"this is a test\", \"channel\":\"%s\"}", channel1.Name), "application/json"); err != nil {
t.Fatal(err)
}
@@ -552,6 +559,10 @@ func TestIncomingWebhooks(t *testing.T) {
t.Fatal(err)
}
+ if _, err := Client.DoPost(url, "payload={\"text\":\""+text+"\"}", "application/x-www-form-urlencoded"); err != nil {
+ t.Fatal(err)
+ }
+
attachmentPayload := `{
"text": "this is a test",
"attachments": [