mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-27 13:48:52 +02:00
91f9f71bf7
* Replace Block references to use pointers throughout all application layers * lint fixes * gofmt file, lint fix Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
40 lines
821 B
Go
40 lines
821 B
Go
package webhook
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/mattermost/focalboard/server/model"
|
|
"github.com/mattermost/focalboard/server/services/config"
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/mattermost/mattermost-server/v6/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")
|
|
}
|
|
}
|