summaryrefslogtreecommitdiffstats
path: root/api4/webhook_test.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-04-27 10:53:38 +0100
committerGeorge Goldberg <george@gberg.me>2018-04-27 10:53:38 +0100
commit2386acb3ddabd8827e21b1862c338a8b13a25de6 (patch)
treed9c5800bf168db532124db3c213c2607402894c6 /api4/webhook_test.go
parent7294644e9d74ca1512a730c597d61a97ccbcf10c (diff)
parent7abd6176e99d3f82711af51f8d75b3142ab73758 (diff)
downloadchat-2386acb3ddabd8827e21b1862c338a8b13a25de6.tar.gz
chat-2386acb3ddabd8827e21b1862c338a8b13a25de6.tar.bz2
chat-2386acb3ddabd8827e21b1862c338a8b13a25de6.zip
Merge branch 'master' into advanced-permissions-phase-2
Diffstat (limited to 'api4/webhook_test.go')
-rw-r--r--api4/webhook_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/api4/webhook_test.go b/api4/webhook_test.go
index 0a295b4b2..e983b6461 100644
--- a/api4/webhook_test.go
+++ b/api4/webhook_test.go
@@ -917,17 +917,21 @@ func TestCommandWebhooks(t *testing.T) {
t.Fatal(err)
}
- if resp, _ := http.Post(Client.Url+"/hooks/commands/123123123123", "application/json", bytes.NewBufferString("{\"text\":\"this is a test\"}")); resp.StatusCode != http.StatusNotFound {
+ if resp, _ := http.Post(Client.Url+"/hooks/commands/123123123123", "application/json", bytes.NewBufferString(`{"text":"this is a test"}`)); resp.StatusCode != http.StatusNotFound {
t.Fatal("expected not-found for non-existent hook")
}
+ if resp, err := http.Post(Client.Url+"/hooks/commands/"+hook.Id, "application/json", bytes.NewBufferString(`{"text":"invalid`)); err != nil || resp.StatusCode != http.StatusBadRequest {
+ t.Fatal(err)
+ }
+
for i := 0; i < 5; i++ {
- if resp, err := http.Post(Client.Url+"/hooks/commands/"+hook.Id, "application/json", bytes.NewBufferString("{\"text\":\"this is a test\"}")); err != nil || resp.StatusCode != http.StatusOK {
+ if resp, err := http.Post(Client.Url+"/hooks/commands/"+hook.Id, "application/json", bytes.NewBufferString(`{"text":"this is a test"}`)); err != nil || resp.StatusCode != http.StatusOK {
t.Fatal(err)
}
}
- if resp, _ := http.Post(Client.Url+"/hooks/commands/"+hook.Id, "application/json", bytes.NewBufferString("{\"text\":\"this is a test\"}")); resp.StatusCode != http.StatusBadRequest {
+ if resp, _ := http.Post(Client.Url+"/hooks/commands/"+hook.Id, "application/json", bytes.NewBufferString(`{"text":"this is a test"}`)); resp.StatusCode != http.StatusBadRequest {
t.Fatal("expected error for sixth usage")
}
}