[MM-47378] Respond with bad requests for wrong query parameters 'roles' in getUsers (#21569)
* Respond with bad requests for wrong query parameters in roles * Revert "Respond with bad requests for wrong query parameters in roles" This reverts commit d8374d94e0b1f61ad445127010f9780475c48d1a. * Add GetUser client function to query with channel_id and roles * Return bad parameters error on invalid roles * Make client function generic, lint fixes * i18n strings addition * Validate 'role', add stricter check for comma separated roles
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fc31b1713e
Коммит
0193bfd7de
@@ -2410,6 +2410,20 @@ func TestGetUsers(t *testing.T) {
|
||||
// Check default params for page and per_page
|
||||
_, err = client.DoAPIGet("/users", "")
|
||||
require.NoError(t, err)
|
||||
|
||||
// Check role params validity
|
||||
_, _, err = client.GetUsersWithCustomQueryParameters(0, 5, "in_channel=random_channel_id&channel_roles=random_role_doesnt_exist", "")
|
||||
require.Error(t, err)
|
||||
require.Equal(t, err.Error(), ": Invalid or missing channelRoles in request body.")
|
||||
_, _, err = client.GetUsersWithCustomQueryParameters(0, 5, "in_team=random_channel_id&team_roles=random_role_doesnt_exist", "")
|
||||
require.Error(t, err)
|
||||
require.Equal(t, err.Error(), ": Invalid or missing teamRoles in request body.")
|
||||
_, _, err = client.GetUsersWithCustomQueryParameters(0, 5, "roles=random_role_doesnt_exist%2Csystem_user", "")
|
||||
require.Error(t, err)
|
||||
require.Equal(t, err.Error(), ": Invalid or missing roles in request body.")
|
||||
_, _, err = client.GetUsersWithCustomQueryParameters(0, 5, "role=random_role_doesnt_exist", "")
|
||||
require.Error(t, err)
|
||||
require.Equal(t, err.Error(), ": Invalid or missing role in request body.")
|
||||
})
|
||||
|
||||
th.Client.Logout()
|
||||
|
||||
Ссылка в новой задаче
Block a user