webhook cleanup
This commit is contained in:
parent
5e8789cb14
commit
923ac19769
2 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/golang/mock/gomock"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/services/config"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/services/store/mockstore"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/webhook"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/ws"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore/mocks"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -15,9 +16,11 @@ import (
|
|||
func TestGetParentID(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
cfg := config.Configuration{}
|
||||
store := mockstore.NewMockStore(ctrl)
|
||||
wsserver := ws.NewServer()
|
||||
app := New(&config.Configuration{}, store, wsserver, &mocks.FileBackend{})
|
||||
webhook := webhook.New(&cfg)
|
||||
app := New(&cfg, store, wsserver, &mocks.FileBackend{}, webhook)
|
||||
|
||||
t.Run("success query", func(t *testing.T) {
|
||||
store.EXPECT().GetParentID(gomock.Eq("test-id")).Return("test-parent-id", nil)
|
||||
|
|
|
@ -12,6 +12,10 @@ import (
|
|||
|
||||
// NotifyUpdate calls webhooks
|
||||
func (wh *WebhookClient) NotifyUpdate(block model.Block) {
|
||||
if len(wh.config.WebhookUpdate) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
json, err := json.Marshal(block)
|
||||
if err != nil {
|
||||
log.Fatal("NotifyUpdate: json.Marshal", err)
|
||||
|
|
Loading…
Reference in a new issue