diff options
author | Martin Kraft <martinkraft@gmail.com> | 2018-05-15 07:45:28 -0400 |
---|---|---|
committer | Martin Kraft <martinkraft@gmail.com> | 2018-05-15 07:45:28 -0400 |
commit | f82cc7896dd57c4c96471bcbbd2b1a39f908e5e7 (patch) | |
tree | d3899b890408f6f16b2d5f543bf975475f1a5584 /api4/webhook_test.go | |
parent | 51bd710ecdca6628461c9fa2679737073e4d5059 (diff) | |
parent | a1656dffa98fbc8865e476b214e4e0c562547d39 (diff) | |
download | chat-f82cc7896dd57c4c96471bcbbd2b1a39f908e5e7.tar.gz chat-f82cc7896dd57c4c96471bcbbd2b1a39f908e5e7.tar.bz2 chat-f82cc7896dd57c4c96471bcbbd2b1a39f908e5e7.zip |
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'api4/webhook_test.go')
-rw-r--r-- | api4/webhook_test.go | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/api4/webhook_test.go b/api4/webhook_test.go index e983b6461..441fb8bb7 100644 --- a/api4/webhook_test.go +++ b/api4/webhook_test.go @@ -4,8 +4,6 @@ package api4 import ( - "bytes" - "net/http" "testing" "github.com/stretchr/testify/assert" @@ -892,46 +890,3 @@ func TestDeleteOutgoingHook(t *testing.T) { CheckForbiddenStatus(t, resp) }) } - -func TestCommandWebhooks(t *testing.T) { - th := Setup().InitBasic().InitSystemAdmin() - defer th.TearDown() - - Client := th.SystemAdminClient - - cmd := &model.Command{ - CreatorId: th.BasicUser.Id, - TeamId: th.BasicTeam.Id, - URL: "http://nowhere.com", - Method: model.COMMAND_METHOD_POST, - Trigger: "delayed"} - - cmd, _ = Client.CreateCommand(cmd) - args := &model.CommandArgs{ - TeamId: th.BasicTeam.Id, - UserId: th.BasicUser.Id, - ChannelId: th.BasicChannel.Id, - } - hook, err := th.App.CreateCommandWebhook(cmd.Id, args) - if err != nil { - 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 { - 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 { - 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 { - t.Fatal("expected error for sixth usage") - } -} |