[MM-41907] Don't return custom groups when feature is disabled (#19644)
* tools updates * Revert "tools updates" This reverts commit 6293297b55803c5a263e200ebd80192899666ae9. * dont return custom groups when feature is disabled * adding small change to test Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local> Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Этот коммит содержится в:
@@ -1229,6 +1229,30 @@ func TestGetGroups(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, groups, 1)
|
||||
assert.Equal(t, groups[0].Id, group2.Id)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableCustomGroups = false
|
||||
})
|
||||
|
||||
// Specify custom groups source when feature is disabled
|
||||
opts.Source = model.GroupSourceCustom
|
||||
_, response, err := th.Client.GetGroups(opts)
|
||||
require.Error(t, err)
|
||||
CheckNotImplementedStatus(t, response)
|
||||
|
||||
// Specify ldap groups source when custom groups feature is disabled
|
||||
opts.Source = model.GroupSourceLdap
|
||||
groups, _, err = th.Client.GetGroups(opts)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, groups, 1)
|
||||
assert.Equal(t, groups[0].Source, model.GroupSourceLdap)
|
||||
|
||||
// don't include source and should only get ldap groups in response
|
||||
opts.Source = ""
|
||||
groups, _, err = th.Client.GetGroups(opts)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, groups, 1)
|
||||
assert.Equal(t, groups[0].Source, model.GroupSourceLdap)
|
||||
}
|
||||
|
||||
func TestGetGroupsByUserId(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user