Channels/api4 testing improvements (#22938)
* api4/post_test: fix missing TearDown * api4/plugin_test: dont test timeout, saving 120s * api4/channel_test: dont try to delete town square * api4/channel_test: check public channel names deterministically * api4/file_test: fix darwin assertions on go files * api4/notify_admin_test: fix expect/actual order * api4/team_test: make TestGetAllTeams deterministic * api4/plugin_test: avoid nested test helpers * api4/post_test: avoid nested test helpers * api4/websocket_test: externalize log buffer * testlib/helper: unset common env * linting issues * simplify TestGetFileHeaders * team_test: leverage ElementsMatch
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
dd2b1db420
Коммит
89f2ebc836
@@ -1173,11 +1173,10 @@ func TestGetAllTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
var teams []*model.Team
|
||||
var count int64
|
||||
var resp *model.Response
|
||||
var err2 error
|
||||
if tc.WithCount {
|
||||
teams, count, resp, err2 = client.GetAllTeamsWithTotalCount("", tc.Page, tc.PerPage)
|
||||
teams, _, resp, err2 = client.GetAllTeamsWithTotalCount("", tc.Page, tc.PerPage)
|
||||
} else {
|
||||
teams, resp, err2 = client.GetAllTeams("", tc.Page, tc.PerPage)
|
||||
}
|
||||
@@ -1187,11 +1186,12 @@ func TestGetAllTeams(t *testing.T) {
|
||||
return
|
||||
}
|
||||
require.NoError(t, err2)
|
||||
require.Equal(t, len(tc.ExpectedTeams), len(teams))
|
||||
for idx, team := range teams {
|
||||
assert.Equal(t, tc.ExpectedTeams[idx], team.Id)
|
||||
|
||||
actualTeamIds := make([]string, 0, len(tc.ExpectedTeams))
|
||||
for _, team := range teams {
|
||||
actualTeamIds = append(actualTeamIds, team.Id)
|
||||
}
|
||||
require.Equal(t, tc.ExpectedCount, count)
|
||||
require.ElementsMatch(t, tc.ExpectedTeams, actualTeamIds)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user