diff options
author | David Lu <david.lu@hotmail.com> | 2016-05-27 08:35:55 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-05-27 08:35:55 -0700 |
commit | 0d0734ac9845ef32c55ebf4c3185ba85065c5940 (patch) | |
tree | aaaf2522d8cacbf06fce4aee0d89aac1f1d9ec19 /api/webhook_test.go | |
parent | 1e7805b79025823fba4479ffaa354e9c756d6622 (diff) | |
download | chat-0d0734ac9845ef32c55ebf4c3185ba85065c5940.tar.gz chat-0d0734ac9845ef32c55ebf4c3185ba85065c5940.tar.bz2 chat-0d0734ac9845ef32c55ebf4c3185ba85065c5940.zip |
Added duplicated trigger validation (#3124)
Diffstat (limited to 'api/webhook_test.go')
-rw-r--r-- | api/webhook_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/api/webhook_test.go b/api/webhook_test.go index 1b13bb5d4..80ee8ad7d 100644 --- a/api/webhook_test.go +++ b/api/webhook_test.go @@ -262,6 +262,17 @@ func TestCreateOutgoingHook(t *testing.T) { t.Fatal("team ids didn't match") } + hook = &model.OutgoingWebhook{ChannelId: channel1.Id, TriggerWords: []string{"cats", "dogs"}, CallbackURLs: []string{"http://nowhere.com", "http://cats.com"}} + hook1 := &model.OutgoingWebhook{ChannelId: channel1.Id, TriggerWords: []string{"cats"}, CallbackURLs: []string{"http://nowhere.com"}} + + if _, err := Client.CreateOutgoingWebhook(hook); err != nil { + t.Fatal("multiple trigger words and urls failed") + } + + if _, err := Client.CreateOutgoingWebhook(hook1); err == nil { + t.Fatal("should have failed - duplicate trigger words and urls") + } + hook = &model.OutgoingWebhook{ChannelId: "junk", CallbackURLs: []string{"http://nowhere.com"}} if _, err := Client.CreateOutgoingWebhook(hook); err == nil { t.Fatal("should have failed - bad channel id") |