MM-45193 Use context for channel logging (#20575)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5f4da3f308
Коммит
6dc897b04f
@@ -78,7 +78,7 @@ func TestSessionHasPermissionToChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("basic user can access basic channel", func(t *testing.T) {
|
||||
assert.True(t, th.App.SessionHasPermissionToChannel(session, th.BasicChannel.Id, model.PermissionAddReaction))
|
||||
assert.True(t, th.App.SessionHasPermissionToChannel(th.Context, session, th.BasicChannel.Id, model.PermissionAddReaction))
|
||||
})
|
||||
|
||||
t.Run("does not panic if fetching channel causes an error", func(t *testing.T) {
|
||||
@@ -103,7 +103,7 @@ func TestSessionHasPermissionToChannel(t *testing.T) {
|
||||
|
||||
// If there's an error returned from the GetChannel call the code should continue to cascade and since there
|
||||
// are no session level permissions in this test case, the permission should be denied.
|
||||
assert.False(t, th.App.SessionHasPermissionToChannel(session, th.BasicUser.Id, model.PermissionAddReaction))
|
||||
assert.False(t, th.App.SessionHasPermissionToChannel(th.Context, session, th.BasicUser.Id, model.PermissionAddReaction))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -113,16 +113,16 @@ func TestHasPermissionToCategory(t *testing.T) {
|
||||
session, err := th.App.CreateSession(&model.Session{UserId: th.BasicUser.Id, Props: model.StringMap{}})
|
||||
require.Nil(t, err)
|
||||
|
||||
categories, err := th.App.GetSidebarCategoriesForTeamForUser(th.BasicUser.Id, th.BasicTeam.Id)
|
||||
categories, err := th.App.GetSidebarCategoriesForTeamForUser(th.Context, th.BasicUser.Id, th.BasicTeam.Id)
|
||||
require.Nil(t, err)
|
||||
|
||||
_, err = th.App.GetSession(session.Token)
|
||||
require.Nil(t, err)
|
||||
require.True(t, th.App.SessionHasPermissionToCategory(*session, th.BasicUser.Id, th.BasicTeam.Id, categories.Order[0]))
|
||||
require.True(t, th.App.SessionHasPermissionToCategory(th.Context, *session, th.BasicUser.Id, th.BasicTeam.Id, categories.Order[0]))
|
||||
|
||||
categories2, err := th.App.GetSidebarCategoriesForTeamForUser(th.BasicUser2.Id, th.BasicTeam.Id)
|
||||
categories2, err := th.App.GetSidebarCategoriesForTeamForUser(th.Context, th.BasicUser2.Id, th.BasicTeam.Id)
|
||||
require.Nil(t, err)
|
||||
require.False(t, th.App.SessionHasPermissionToCategory(*session, th.BasicUser.Id, th.BasicTeam.Id, categories2.Order[0]))
|
||||
require.False(t, th.App.SessionHasPermissionToCategory(th.Context, *session, th.BasicUser.Id, th.BasicTeam.Id, categories2.Order[0]))
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToGroup(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user