Files
mostlymatter/server/boards/services/webhook/webhook_test.go
Jesse Hallam bb02b35048 Expose public/ API as submodule (#23345)
* model -> public/model

* plugin -> public/plugin

* public/model/utils -> public/utils

* platform/shared/mlog -> public/shared/mlog

* platform/shared/i18n -> public/shared/i18n

* platform/shared/markdown -> public/shared/markdown

* platform/services/timezones -> public/shared/timezones

* channels/einterfaces -> einterfaces

* expose public/ submodule

* go mod tidy

* .github: cache-dependency-path, setup-go-work

* modules-tidy for public/ too

* remove old gomodtidy
2023-05-10 13:07:02 -03:00

44 строки
980 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package webhook
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/mattermost/mattermost-server/server/v8/boards/model"
"github.com/mattermost/mattermost-server/server/v8/boards/services/config"
"github.com/mattermost/mattermost-server/server/public/shared/mlog"
)
func TestClientUpdateNotify(t *testing.T) {
var isNotified bool
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
isNotified = true
}))
defer ts.Close()
cfg := &config.Configuration{
WebhookUpdate: []string{ts.URL},
}
logger := mlog.CreateConsoleTestLogger(false, mlog.LvlDebug)
defer func() {
err := logger.Shutdown()
assert.NoError(t, err)
}()
client := NewClient(cfg, logger)
client.NotifyUpdate(&model.Block{})
if !isNotified {
t.Error("webhook url not be notified")
}
}