Fixed errcheck issues in server/channels/app/session_test.go (#29198)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
11edef7af0
Коммит
94036947c8
@@ -138,7 +138,6 @@ issues:
|
|||||||
channels/app/security_update_check.go|\
|
channels/app/security_update_check.go|\
|
||||||
channels/app/server.go|\
|
channels/app/server.go|\
|
||||||
channels/app/server_test.go|\
|
channels/app/server_test.go|\
|
||||||
channels/app/session_test.go|\
|
|
||||||
channels/app/slack.go|\
|
channels/app/slack.go|\
|
||||||
channels/app/slashcommands/auto_environment.go|\
|
channels/app/slashcommands/auto_environment.go|\
|
||||||
channels/app/slashcommands/command_loadtest.go|\
|
channels/app/slashcommands/command_loadtest.go|\
|
||||||
|
|||||||
@@ -456,12 +456,14 @@ func TestSetExtraSessionProps(t *testing.T) {
|
|||||||
|
|
||||||
resetSession := func(session *model.Session) {
|
resetSession := func(session *model.Session) {
|
||||||
session.AddProp("testProp", "")
|
session.AddProp("testProp", "")
|
||||||
th.Server.Store().Session().UpdateProps(session)
|
err := th.Server.Store().Session().UpdateProps(session)
|
||||||
|
require.NoError(t, err)
|
||||||
th.App.ClearSessionCacheForUser(session.UserId)
|
th.App.ClearSessionCacheForUser(session.UserId)
|
||||||
}
|
}
|
||||||
t.Run("do not update the session if there are no props", func(t *testing.T) {
|
t.Run("do not update the session if there are no props", func(t *testing.T) {
|
||||||
defer resetSession(session)
|
defer resetSession(session)
|
||||||
th.App.SetExtraSessionProps(session, map[string]string{})
|
appErr := th.App.SetExtraSessionProps(session, map[string]string{})
|
||||||
|
require.Nil(t, appErr)
|
||||||
updatedSession, _ := th.App.GetSession(session.Token)
|
updatedSession, _ := th.App.GetSession(session.Token)
|
||||||
storeSession, _ := th.Server.Store().Session().Get(th.Context, session.Id)
|
storeSession, _ := th.Server.Store().Session().Get(th.Context, session.Id)
|
||||||
assert.Equal(t, session, updatedSession)
|
assert.Equal(t, session, updatedSession)
|
||||||
@@ -469,7 +471,8 @@ func TestSetExtraSessionProps(t *testing.T) {
|
|||||||
})
|
})
|
||||||
t.Run("update the session with the selected prop", func(t *testing.T) {
|
t.Run("update the session with the selected prop", func(t *testing.T) {
|
||||||
defer resetSession(session)
|
defer resetSession(session)
|
||||||
th.App.SetExtraSessionProps(session, map[string]string{"testProp": "true"})
|
appErr := th.App.SetExtraSessionProps(session, map[string]string{"testProp": "true"})
|
||||||
|
require.Nil(t, appErr)
|
||||||
updatedSession, _ := th.App.GetSession(session.Token)
|
updatedSession, _ := th.App.GetSession(session.Token)
|
||||||
storeSession, _ := th.Server.Store().Session().Get(th.Context, session.Id)
|
storeSession, _ := th.Server.Store().Session().Get(th.Context, session.Id)
|
||||||
assert.Equal(t, "true", updatedSession.Props["testProp"])
|
assert.Equal(t, "true", updatedSession.Props["testProp"])
|
||||||
@@ -478,10 +481,12 @@ func TestSetExtraSessionProps(t *testing.T) {
|
|||||||
t.Run("do not update the session if the prop is the same", func(t *testing.T) {
|
t.Run("do not update the session if the prop is the same", func(t *testing.T) {
|
||||||
defer resetSession(session)
|
defer resetSession(session)
|
||||||
session.AddProp("testProp", "true")
|
session.AddProp("testProp", "true")
|
||||||
th.Server.Store().Session().UpdateProps(session)
|
err := th.Server.Store().Session().UpdateProps(session)
|
||||||
|
require.NoError(t, err)
|
||||||
th.App.ClearSessionCacheForUser(session.UserId)
|
th.App.ClearSessionCacheForUser(session.UserId)
|
||||||
|
|
||||||
th.App.SetExtraSessionProps(session, map[string]string{"testProp": "true"})
|
appErr := th.App.SetExtraSessionProps(session, map[string]string{"testProp": "true"})
|
||||||
|
require.Nil(t, appErr)
|
||||||
updatedSession, _ := th.App.GetSession(session.Token)
|
updatedSession, _ := th.App.GetSession(session.Token)
|
||||||
storeSession, _ := th.Server.Store().Session().Get(th.Context, session.Id)
|
storeSession, _ := th.Server.Store().Session().Get(th.Context, session.Id)
|
||||||
assert.Equal(t, session, updatedSession)
|
assert.Equal(t, session, updatedSession)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user