Mm 16623 fix all initialism errors in channels/app and channels/api4 dir (#25743)
* updated go mod and sum files * fixed var-naming errors in channels/app and channels/api4 dir * Revert "updated go mod and sum files" This reverts commit 088dd00a848c2c31952c29f0a2a28a9fb47fc3f7. * renamed a cost .
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
293caec0c7
Коммит
ebdc964161
@@ -681,14 +681,14 @@ func (th *TestHelper) CreateChannelWithClient(client *model.Client4, channelType
|
||||
return th.CreateChannelWithClientAndTeam(client, channelType, th.BasicTeam.Id)
|
||||
}
|
||||
|
||||
func (th *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType model.ChannelType, teamId string) *model.Channel {
|
||||
func (th *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType model.ChannelType, teamID string) *model.Channel {
|
||||
id := model.NewId()
|
||||
|
||||
channel := &model.Channel{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: GenerateTestChannelName(),
|
||||
Type: channelType,
|
||||
TeamId: teamId,
|
||||
TeamId: teamID,
|
||||
}
|
||||
|
||||
rchannel, _, err := client.CreateChannel(context.Background(), channel)
|
||||
@@ -975,7 +975,7 @@ func GenerateTestAppName() string {
|
||||
return "fakeoauthapp" + model.NewRandomString(10)
|
||||
}
|
||||
|
||||
func GenerateTestId() string {
|
||||
func GenerateTestID() string {
|
||||
return model.NewId()
|
||||
}
|
||||
|
||||
|
||||
@@ -732,7 +732,7 @@ func TestCreateGroupChannel(t *testing.T) {
|
||||
CheckBadRequestStatus(t, resp)
|
||||
require.Nil(t, rgc)
|
||||
|
||||
_, resp, err = client.CreateGroupChannel(context.Background(), []string{user.Id, user2.Id, user3.Id, GenerateTestId()})
|
||||
_, resp, err = client.CreateGroupChannel(context.Background(), []string{user.Id, user2.Id, user3.Id, GenerateTestID()})
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
@@ -1087,7 +1087,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
|
||||
require.Len(t, channels, 1, "should return 1 channel")
|
||||
require.Equal(t, output[0], channels[0].DisplayName, "missing channel")
|
||||
|
||||
input = append(input, GenerateTestId())
|
||||
input = append(input, GenerateTestID())
|
||||
input = append(input, th.BasicChannel2.Id)
|
||||
input = append(input, th.BasicPrivateChannel.Id)
|
||||
output = append(output, th.BasicChannel2.DisplayName)
|
||||
@@ -1101,7 +1101,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
|
||||
require.Equal(t, output[i], c.DisplayName, "missing channel")
|
||||
}
|
||||
|
||||
_, resp, err := client.GetPublicChannelsByIdsForTeam(context.Background(), GenerateTestId(), input)
|
||||
_, resp, err := client.GetPublicChannelsByIdsForTeam(context.Background(), GenerateTestID(), input)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -1113,7 +1113,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp, err = client.GetPublicChannelsByIdsForTeam(context.Background(), teamId, []string{GenerateTestId()})
|
||||
_, resp, err = client.GetPublicChannelsByIdsForTeam(context.Background(), teamId, []string{GenerateTestID()})
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
@@ -1978,7 +1978,7 @@ func TestDeleteChannel(t *testing.T) {
|
||||
require.Nilf(t, appErr, "Expected nil, Got %v", appErr)
|
||||
require.True(t, ch.DeleteAt != 0, "should have returned one with a populated DeleteAt.")
|
||||
|
||||
post1 := &model.Post{ChannelId: publicChannel1.Id, Message: "a" + GenerateTestId() + "a"}
|
||||
post1 := &model.Post{ChannelId: publicChannel1.Id, Message: "a" + GenerateTestID() + "a"}
|
||||
_, resp, _ := client.CreatePost(context.Background(), post1)
|
||||
require.NotNil(t, resp, "expected response to not be nil")
|
||||
|
||||
@@ -2039,7 +2039,7 @@ func TestDeleteChannel(t *testing.T) {
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
|
||||
c.Logout(context.Background())
|
||||
resp, err = c.DeleteChannel(context.Background(), GenerateTestId())
|
||||
resp, err = c.DeleteChannel(context.Background(), GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
|
||||
@@ -2795,7 +2795,7 @@ func TestGetPinnedPosts(t *testing.T) {
|
||||
posts, resp, _ = client.GetPinnedPosts(context.Background(), channel.Id, resp.Etag)
|
||||
CheckEtag(t, posts, resp)
|
||||
|
||||
_, resp, err = client.GetPinnedPosts(context.Background(), GenerateTestId(), "")
|
||||
_, resp, err = client.GetPinnedPosts(context.Background(), GenerateTestID(), "")
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -3092,7 +3092,7 @@ func TestAddChannelMember(t *testing.T) {
|
||||
require.Equal(t, privateChannel.Id, cm.ChannelId, "should have returned exact channel")
|
||||
require.Equal(t, user2.Id, cm.UserId, "should have returned exact user added to private channel")
|
||||
|
||||
post := &model.Post{ChannelId: publicChannel.Id, Message: "a" + GenerateTestId() + "a"}
|
||||
post := &model.Post{ChannelId: publicChannel.Id, Message: "a" + GenerateTestID() + "a"}
|
||||
rpost, _, err := client.CreatePost(context.Background(), post)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -3106,7 +3106,7 @@ func TestAddChannelMember(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp, err = client.AddChannelMemberWithRootId(context.Background(), publicChannel.Id, user.Id, GenerateTestId())
|
||||
_, resp, err = client.AddChannelMemberWithRootId(context.Background(), publicChannel.Id, user.Id, GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
@@ -3119,7 +3119,7 @@ func TestAddChannelMember(t *testing.T) {
|
||||
CheckBadRequestStatus(t, resp)
|
||||
require.Nil(t, cm, "should return nothing")
|
||||
|
||||
_, resp, err = client.AddChannelMember(context.Background(), publicChannel.Id, GenerateTestId())
|
||||
_, resp, err = client.AddChannelMember(context.Background(), publicChannel.Id, GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
@@ -3127,7 +3127,7 @@ func TestAddChannelMember(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp, err = client.AddChannelMember(context.Background(), GenerateTestId(), user2.Id)
|
||||
_, resp, err = client.AddChannelMember(context.Background(), GenerateTestID(), user2.Id)
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ func TestUpdateCommand(t *testing.T) {
|
||||
cmd1, _ = th.App.CreateCommand(cmd1)
|
||||
|
||||
cmd2 := &model.Command{
|
||||
CreatorId: GenerateTestId(),
|
||||
CreatorId: GenerateTestID(),
|
||||
TeamId: team.Id,
|
||||
URL: "http://nowhere.com/change",
|
||||
Method: model.CommandMethodGet,
|
||||
@@ -127,7 +127,7 @@ func TestUpdateCommand(t *testing.T) {
|
||||
|
||||
require.Equal(t, cmd1.Token, rcmd.Token, "Token should have not updated")
|
||||
|
||||
cmd2.Id = GenerateTestId()
|
||||
cmd2.Id = GenerateTestID()
|
||||
|
||||
rcmd, resp, err := client.UpdateCommand(context.Background(), cmd2)
|
||||
require.Error(t, err)
|
||||
@@ -142,7 +142,7 @@ func TestUpdateCommand(t *testing.T) {
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
cmd2.Id = cmd1.Id
|
||||
cmd2.TeamId = GenerateTestId()
|
||||
cmd2.TeamId = GenerateTestID()
|
||||
|
||||
_, resp, err = client.UpdateCommand(context.Background(), cmd2)
|
||||
require.Error(t, err)
|
||||
@@ -194,7 +194,7 @@ func TestMoveCommand(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
resp, err = client.MoveCommand(context.Background(), GenerateTestId(), rcmd1.Id)
|
||||
resp, err = client.MoveCommand(context.Background(), GenerateTestID(), rcmd1.Id)
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
})
|
||||
@@ -252,7 +252,7 @@ func TestDeleteCommand(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
resp, err = client.DeleteCommand(context.Background(), GenerateTestId())
|
||||
resp, err = client.DeleteCommand(context.Background(), GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
})
|
||||
|
||||
@@ -1514,7 +1514,7 @@ func TestPatchPost(t *testing.T) {
|
||||
|
||||
t.Run("unknown post", func(t *testing.T) {
|
||||
patch := &model.PostPatch{}
|
||||
_, resp, err := client.PatchPost(context.Background(), GenerateTestId(), patch)
|
||||
_, resp, err := client.PatchPost(context.Background(), GenerateTestID(), patch)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
})
|
||||
@@ -1634,7 +1634,7 @@ func TestPinPost(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
resp, err = client.PinPost(context.Background(), GenerateTestId())
|
||||
resp, err = client.PinPost(context.Background(), GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -1664,7 +1664,7 @@ func TestUnpinPost(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
resp, err = client.UnpinPost(context.Background(), GenerateTestId())
|
||||
resp, err = client.UnpinPost(context.Background(), GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -1920,7 +1920,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, rpl.Posts)
|
||||
|
||||
rpl, _, err = client.GetFlaggedPostsForUserInChannel(context.Background(), user.Id, GenerateTestId(), 0, 10)
|
||||
rpl, _, err = client.GetFlaggedPostsForUserInChannel(context.Background(), user.Id, GenerateTestID(), 0, 10)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, rpl.Posts)
|
||||
|
||||
@@ -1948,7 +1948,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, rpl.Posts)
|
||||
|
||||
rpl, _, err = client.GetFlaggedPostsForUserInTeam(context.Background(), user.Id, GenerateTestId(), 0, 10)
|
||||
rpl, _, err = client.GetFlaggedPostsForUserInTeam(context.Background(), user.Id, GenerateTestID(), 0, 10)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, rpl.Posts)
|
||||
|
||||
@@ -2028,7 +2028,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp, err = client.GetFlaggedPostsForUser(context.Background(), GenerateTestId(), 0, 10)
|
||||
_, resp, err = client.GetFlaggedPostsForUser(context.Background(), GenerateTestID(), 0, 10)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -4273,7 +4273,7 @@ func TestAcknowledgePost(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp, err = client.AcknowledgePost(context.Background(), GenerateTestId(), th.BasicUser.Id)
|
||||
_, resp, err = client.AcknowledgePost(context.Background(), GenerateTestID(), th.BasicUser.Id)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -4313,7 +4313,7 @@ func TestUnacknowledgePost(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
resp, err = client.UnacknowledgePost(context.Background(), GenerateTestId(), th.BasicUser.Id)
|
||||
resp, err = client.UnacknowledgePost(context.Background(), GenerateTestID(), th.BasicUser.Id)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ func TestSaveReaction(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("react-to-not-existing-post-id", func(t *testing.T) {
|
||||
reaction.PostId = GenerateTestId()
|
||||
reaction.PostId = GenerateTestID()
|
||||
|
||||
_, resp, err := client.SaveReaction(context.Background(), reaction)
|
||||
require.Error(t, err)
|
||||
@@ -96,7 +96,7 @@ func TestSaveReaction(t *testing.T) {
|
||||
|
||||
t.Run("react-as-not-existing-user-id", func(t *testing.T) {
|
||||
reaction.PostId = postId
|
||||
reaction.UserId = GenerateTestId()
|
||||
reaction.UserId = GenerateTestID()
|
||||
|
||||
_, resp, err := client.SaveReaction(context.Background(), reaction)
|
||||
require.Error(t, err)
|
||||
@@ -254,7 +254,7 @@ func TestGetReactions(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get-reactions-of-not-existing-post-id", func(t *testing.T) {
|
||||
_, resp, err := client.GetReactions(context.Background(), GenerateTestId())
|
||||
_, resp, err := client.GetReactions(context.Background(), GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
})
|
||||
@@ -375,7 +375,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("delete-reaction-from-not-existing-post-id", func(t *testing.T) {
|
||||
r1.PostId = GenerateTestId()
|
||||
r1.PostId = GenerateTestID()
|
||||
resp, err := client.DeleteReaction(context.Background(), r1)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -391,7 +391,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
|
||||
t.Run("delete-reaction-from-not-existing-user-id", func(t *testing.T) {
|
||||
r1.PostId = postId
|
||||
r1.UserId = GenerateTestId()
|
||||
r1.UserId = GenerateTestID()
|
||||
|
||||
resp, err := client.DeleteReaction(context.Background(), r1)
|
||||
require.Error(t, err)
|
||||
|
||||
@@ -524,7 +524,7 @@ func TestPatchTeam(t *testing.T) {
|
||||
patch.CompanyName = model.NewString("Other company name")
|
||||
patch.AllowOpenInvite = model.NewBool(true)
|
||||
|
||||
_, resp, err := th.Client.PatchTeam(context.Background(), GenerateTestId(), patch)
|
||||
_, resp, err := th.Client.PatchTeam(context.Background(), GenerateTestID(), patch)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -2162,11 +2162,11 @@ func TestAddTeamMember(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp, err = client.AddTeamMember(context.Background(), GenerateTestId(), otherUser.Id)
|
||||
_, resp, err = client.AddTeamMember(context.Background(), GenerateTestID(), otherUser.Id)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
_, resp, err = client.AddTeamMember(context.Background(), team.Id, GenerateTestId())
|
||||
_, resp, err = client.AddTeamMember(context.Background(), team.Id, GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
@@ -2257,7 +2257,7 @@ func TestAddTeamMember(t *testing.T) {
|
||||
th.App.DeleteToken(token)
|
||||
|
||||
// invalid team id
|
||||
testId := GenerateTestId()
|
||||
testId := GenerateTestID()
|
||||
token = model.NewToken(
|
||||
app.TokenTypeTeamInvitation,
|
||||
model.MapToJSON(map[string]string{"teamId": testId}),
|
||||
@@ -2531,18 +2531,18 @@ func TestAddTeamMembers(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp, err = client.AddTeamMembers(context.Background(), GenerateTestId(), userList)
|
||||
_, resp, err = client.AddTeamMembers(context.Background(), GenerateTestID(), userList)
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
testUserList := append(userList, GenerateTestId())
|
||||
testUserList := append(userList, GenerateTestID())
|
||||
_, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList)
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
// Test with many users.
|
||||
for i := 0; i < 260; i++ {
|
||||
testUserList = append(testUserList, GenerateTestId())
|
||||
testUserList = append(testUserList, GenerateTestID())
|
||||
}
|
||||
_, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList)
|
||||
require.Error(t, err)
|
||||
|
||||
@@ -2469,7 +2469,7 @@ func TestUpdateUserActive(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
resp, err = th.Client.UpdateUserActive(context.Background(), GenerateTestId(), true)
|
||||
resp, err = th.Client.UpdateUserActive(context.Background(), GenerateTestID(), true)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -3672,7 +3672,7 @@ func TestVerifyUserEmail(t *testing.T) {
|
||||
_, err = th.Client.VerifyUserEmail(context.Background(), token.Token)
|
||||
require.NoError(t, err)
|
||||
|
||||
resp, err := th.Client.VerifyUserEmail(context.Background(), GenerateTestId())
|
||||
resp, err := th.Client.VerifyUserEmail(context.Background(), GenerateTestID())
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user