MM-31063: Change constants to use CamelCase (#16608)
* MM-31063: Change constants to use CamelCase * store package * change allcaps to camel case (#16615) * New tools.mod Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8b6ac5f5d2
Коммит
c1dd23a3c8
@@ -2285,8 +2285,8 @@ func TestUpdateChannelRoles(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
const CHANNEL_ADMIN = "channel_user channel_admin"
|
||||
const CHANNEL_MEMBER = "channel_user"
|
||||
const ChannelAdmin = "channel_user channel_admin"
|
||||
const ChannelMember = "channel_user"
|
||||
|
||||
// User 1 creates a channel, making them channel admin by default.
|
||||
channel := th.CreatePublicChannel()
|
||||
@@ -2295,44 +2295,44 @@ func TestUpdateChannelRoles(t *testing.T) {
|
||||
th.App.AddUserToChannel(th.BasicUser2, channel)
|
||||
|
||||
// User 1 promotes User 2
|
||||
pass, resp := Client.UpdateChannelRoles(channel.Id, th.BasicUser2.Id, CHANNEL_ADMIN)
|
||||
pass, resp := Client.UpdateChannelRoles(channel.Id, th.BasicUser2.Id, ChannelAdmin)
|
||||
CheckNoError(t, resp)
|
||||
require.True(t, pass, "should have passed")
|
||||
|
||||
member, resp := Client.GetChannelMember(channel.Id, th.BasicUser2.Id, "")
|
||||
CheckNoError(t, resp)
|
||||
require.Equal(t, CHANNEL_ADMIN, member.Roles, "roles don't match")
|
||||
require.Equal(t, ChannelAdmin, member.Roles, "roles don't match")
|
||||
|
||||
// User 1 demotes User 2
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser2.Id, CHANNEL_MEMBER)
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser2.Id, ChannelMember)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
th.LoginBasic2()
|
||||
|
||||
// User 2 cannot demote User 1
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser.Id, CHANNEL_MEMBER)
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser.Id, ChannelMember)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
// User 2 cannot promote self
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser2.Id, CHANNEL_ADMIN)
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser2.Id, ChannelAdmin)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
th.LoginBasic()
|
||||
|
||||
// User 1 demotes self
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser.Id, CHANNEL_MEMBER)
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser.Id, ChannelMember)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
// System Admin promotes User 1
|
||||
_, resp = th.SystemAdminClient.UpdateChannelRoles(channel.Id, th.BasicUser.Id, CHANNEL_ADMIN)
|
||||
_, resp = th.SystemAdminClient.UpdateChannelRoles(channel.Id, th.BasicUser.Id, ChannelAdmin)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
// System Admin demotes User 1
|
||||
_, resp = th.SystemAdminClient.UpdateChannelRoles(channel.Id, th.BasicUser.Id, CHANNEL_MEMBER)
|
||||
_, resp = th.SystemAdminClient.UpdateChannelRoles(channel.Id, th.BasicUser.Id, ChannelMember)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
// System Admin promotes User 1
|
||||
_, resp = th.SystemAdminClient.UpdateChannelRoles(channel.Id, th.BasicUser.Id, CHANNEL_ADMIN)
|
||||
_, resp = th.SystemAdminClient.UpdateChannelRoles(channel.Id, th.BasicUser.Id, ChannelAdmin)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
th.LoginBasic()
|
||||
@@ -2340,16 +2340,16 @@ func TestUpdateChannelRoles(t *testing.T) {
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, th.BasicUser.Id, "junk")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, "junk", CHANNEL_MEMBER)
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, "junk", ChannelMember)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp = Client.UpdateChannelRoles("junk", th.BasicUser.Id, CHANNEL_MEMBER)
|
||||
_, resp = Client.UpdateChannelRoles("junk", th.BasicUser.Id, ChannelMember)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, model.NewId(), CHANNEL_MEMBER)
|
||||
_, resp = Client.UpdateChannelRoles(channel.Id, model.NewId(), ChannelMember)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
_, resp = Client.UpdateChannelRoles(model.NewId(), th.BasicUser.Id, CHANNEL_MEMBER)
|
||||
_, resp = Client.UpdateChannelRoles(model.NewId(), th.BasicUser.Id, ChannelMember)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user