Enable the errorAssertions govet check for mattermost-server code (#17346)
* Enable the errorAssertions govet check for mattermost-server code * Removing unnecesary change * Fixing some tests * Fixing tests * Fixing more after merge * Fixing new offending entries * Fixing small vet checks * Fixing new cases detected by govet * Fixing remote_cluster_test errors * Fixing assertion Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e37e902ddf
Коммит
35d00b4644
@@ -1085,37 +1085,37 @@ func TestSearchFiles(t *testing.T) {
|
||||
Client := th.Client
|
||||
|
||||
filename := "search for fileInfo1"
|
||||
fileInfo1, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, err)
|
||||
fileInfo1, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo1.Id, th.BasicPost.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
filename = "search for fileInfo2"
|
||||
fileInfo2, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, err)
|
||||
fileInfo2, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo2.Id, th.BasicPost.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
filename = "tagged search for fileInfo3"
|
||||
fileInfo3, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, err)
|
||||
fileInfo3, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo3.Id, th.BasicPost.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
filename = "tagged for fileInfo4"
|
||||
fileInfo4, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, err)
|
||||
fileInfo4, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo4.Id, th.BasicPost.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
archivedChannel := th.CreatePublicChannel()
|
||||
fileInfo5, err := th.App.UploadFile(data, archivedChannel.Id, "tagged for fileInfo3")
|
||||
require.Nil(t, err)
|
||||
fileInfo5, appErr := th.App.UploadFile(data, archivedChannel.Id, "tagged for fileInfo3")
|
||||
require.Nil(t, appErr)
|
||||
post := &model.Post{ChannelId: archivedChannel.Id, Message: model.NewId() + "a"}
|
||||
rpost, resp := Client.CreatePost(post)
|
||||
CheckNoError(t, resp)
|
||||
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo5.Id, rpost.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
th.Client.DeleteChannel(archivedChannel.Id)
|
||||
|
||||
terms := "search"
|
||||
|
||||
@@ -2926,7 +2926,7 @@ func TestInviteGuestsToTeam(t *testing.T) {
|
||||
|
||||
t.Run("invalid data in request body", func(t *testing.T) {
|
||||
res, err := th.SystemAdminClient.DoApiPost(th.SystemAdminClient.GetTeamRoute(th.BasicTeam.Id)+"/invite-guests/email", "bad data")
|
||||
require.Error(t, err)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, "api.team.invite_guests_to_channels.invalid_body.app_error", err.Id)
|
||||
require.Equal(t, http.StatusBadRequest, res.StatusCode)
|
||||
})
|
||||
|
||||
@@ -3384,7 +3384,7 @@ func TestLoginWithLag(t *testing.T) {
|
||||
defer mainHelper.ToggleReplicasOff()
|
||||
|
||||
cmdErr := mainHelper.SetReplicationLagForTesting(5)
|
||||
require.Nil(t, cmdErr)
|
||||
require.NoError(t, cmdErr)
|
||||
defer mainHelper.SetReplicationLagForTesting(0)
|
||||
|
||||
_, resp := th.Client.Login(th.BasicUser.Email, th.BasicUser.Password)
|
||||
@@ -6083,7 +6083,7 @@ func TestSetProfileImageWithProviderAttributes(t *testing.T) {
|
||||
doCleanup := func(t *testing.T, th *TestHelper, user *model.User) {
|
||||
info := &model.FileInfo{Path: "users/" + user.Id + "/profile.png"}
|
||||
err = th.cleanupTestFile(info)
|
||||
require.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
t.Run("LDAP user", func(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user