Use require/assert.Empty instead of require/assert.Len(t, X, 0) (#13413)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fdd1ae974f
Коммит
b3e49ec45c
@@ -703,7 +703,7 @@ func TestGetPublicChannelsForTeam(t *testing.T) {
|
||||
|
||||
channels, resp = Client.GetPublicChannelsForTeam(team.Id, 10000, 100, "")
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, channels, 0, "should be no channel")
|
||||
require.Empty(t, channels, "should be no channel")
|
||||
|
||||
_, resp = Client.GetPublicChannelsForTeam("junk", 0, 100, "")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
@@ -843,7 +843,7 @@ func TestGetAllChannels(t *testing.T) {
|
||||
|
||||
channels, resp = th.SystemAdminClient.GetAllChannels(10000, 10000, "")
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, *channels, 0)
|
||||
require.Empty(t, *channels)
|
||||
|
||||
_, resp = Client.GetAllChannels(0, 20, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -874,7 +874,7 @@ func TestGetAllChannelsWithCount(t *testing.T) {
|
||||
|
||||
channels, _, resp = th.SystemAdminClient.GetAllChannelsWithCount(10000, 10000, "")
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, *channels, 0)
|
||||
require.Empty(t, *channels)
|
||||
|
||||
_, _, resp = Client.GetAllChannelsWithCount(0, 20, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -1155,7 +1155,7 @@ func TestSearchGroupChannels(t *testing.T) {
|
||||
channels, resp = Client.SearchGroupChannels(search)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
assert.Len(t, channels, 0)
|
||||
assert.Empty(t, channels)
|
||||
|
||||
// search unprivileged, forbidden
|
||||
th.Client.Logout()
|
||||
@@ -1575,7 +1575,7 @@ func TestGetChannelMembers(t *testing.T) {
|
||||
|
||||
members, resp = Client.GetChannelMembers(th.BasicChannel.Id, 1000, 100000, "")
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, *members, 0, "should be 0 users")
|
||||
require.Empty(t, *members, "should be 0 users")
|
||||
|
||||
_, resp = Client.GetChannelMembers("", 0, 60, "")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
@@ -1613,7 +1613,7 @@ func TestGetChannelMembersByIds(t *testing.T) {
|
||||
|
||||
cm1, resp := Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{"junk"})
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, *cm1, 0, "no users should be returned")
|
||||
require.Empty(t, *cm1, "no users should be returned")
|
||||
|
||||
cm1, resp = Client.GetChannelMembersByIds(th.BasicChannel.Id, []string{"junk", th.BasicUser.Id})
|
||||
CheckNoError(t, resp)
|
||||
@@ -1874,7 +1874,7 @@ func TestGetPinnedPosts(t *testing.T) {
|
||||
|
||||
posts, resp := Client.GetPinnedPosts(channel.Id, "")
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, posts.Posts, 0, "should not have gotten a pinned post")
|
||||
require.Empty(t, posts.Posts, "should not have gotten a pinned post")
|
||||
|
||||
pinnedPost := th.CreatePinnedPost()
|
||||
posts, resp = Client.GetPinnedPosts(channel.Id, "")
|
||||
@@ -2875,7 +2875,7 @@ func TestGetChannelMembersTimezones(t *testing.T) {
|
||||
|
||||
timezone, resp = Client.GetChannelMembersTimezones(th.BasicChannel.Id)
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, timezone, 0, "should return 0 timezone")
|
||||
require.Empty(t, timezone, "should return 0 timezone")
|
||||
}
|
||||
|
||||
func TestChannelMembersMinusGroupMembers(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user