MM24459: Implement ldap picture sync (#14540)
* implement ldap picture sync * add testing timeout, and no change * Revert "add testing timeout, and no change" This reverts commit 765621a7290074e5664c4ca2a2843c84e01f4cf1. * update app-layer * updates from code review * update app-layers * remove debug statements Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d7cb890f34
Коммит
e8081b7a0f
@@ -12,13 +12,16 @@ import (
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
goi18n "github.com/mattermost/go-i18n/i18n"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
func dummyWebsocketHandler(t *testing.T) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, req *http.Request) {
|
||||
mlog.Debug("dummyWebsocketHandler")
|
||||
upgrader := &websocket.Upgrader{
|
||||
ReadBufferSize: 1024,
|
||||
WriteBufferSize: 1024,
|
||||
@@ -106,3 +109,31 @@ func TestHubStopRaceCondition(t *testing.T) {
|
||||
require.FailNow(t, "hub call did not return within 15 seconds after stop")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHubIsRegistered(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
s := httptest.NewServer(dummyWebsocketHandler(t))
|
||||
defer s.Close()
|
||||
|
||||
th.App.HubStart()
|
||||
wc1 := registerDummyWebConn(t, th.App, s.Listener.Addr(), th.BasicUser.Id)
|
||||
wc2 := registerDummyWebConn(t, th.App, s.Listener.Addr(), th.BasicUser.Id)
|
||||
wc3 := registerDummyWebConn(t, th.App, s.Listener.Addr(), th.BasicUser.Id)
|
||||
defer wc1.Close()
|
||||
defer wc2.Close()
|
||||
defer wc3.Close()
|
||||
|
||||
session1 := wc1.session.Load().(*model.Session)
|
||||
|
||||
assert.True(t, th.App.SessionIsRegistered(*session1))
|
||||
assert.True(t, th.App.SessionIsRegistered(*wc2.session.Load().(*model.Session)))
|
||||
assert.True(t, th.App.SessionIsRegistered(*wc3.session.Load().(*model.Session)))
|
||||
|
||||
session4, appErr := th.App.CreateSession(&model.Session{
|
||||
UserId: th.BasicUser2.Id,
|
||||
})
|
||||
require.Nil(t, appErr)
|
||||
assert.False(t, th.App.SessionIsRegistered(*session4))
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user