From a3b10b2c8ddc2a5dba4706fb2989d6c842b8af34 Mon Sep 17 00:00:00 2001 From: Eric Leijonmarck Date: Wed, 3 May 2023 12:02:48 +0100 Subject: [PATCH] RBAC: remove rbac disabled from preferences tests (#67712) remove rbac disabled from preferences tests --- pkg/api/preferences_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/api/preferences_test.go b/pkg/api/preferences_test.go index 871e0f63bad..4d8a1c9fc84 100644 --- a/pkg/api/preferences_test.go +++ b/pkg/api/preferences_test.go @@ -189,7 +189,6 @@ func TestAPIEndpoint_PutCurrentOrgPreferences_AccessControl(t *testing.T) { func TestAPIEndpoint_PatchUserPreferences(t *testing.T) { cfg := setting.NewCfg() - cfg.RBACEnabled = false dashSvc := dashboards.NewFakeDashboardService(t) qResult := &dashboards.Dashboard{UID: "home", ID: 1} @@ -240,7 +239,6 @@ func TestAPIEndpoint_PatchUserPreferences(t *testing.T) { func TestAPIEndpoint_PatchOrgPreferences(t *testing.T) { cfg := setting.NewCfg() - cfg.RBACEnabled = false server := SetupAPITestServer(t, func(hs *HTTPServer) { hs.Cfg = cfg @@ -250,8 +248,9 @@ func TestAPIEndpoint_PatchOrgPreferences(t *testing.T) { input := strings.NewReader(testPatchOrgPreferencesCmd) t.Run("Returns 200 on success", func(t *testing.T) { req := webtest.RequestWithSignedInUser(server.NewRequest(http.MethodPatch, patchOrgPreferencesUrl, input), &user.SignedInUser{ - OrgID: 1, - OrgRole: org.RoleAdmin, + OrgID: 1, + OrgRole: org.RoleAdmin, + Permissions: map[int64]map[string][]string{1: {accesscontrol.ActionOrgsPreferencesWrite: {}}}, }) response, err := server.SendJSON(req) require.NoError(t, err) @@ -262,8 +261,9 @@ func TestAPIEndpoint_PatchOrgPreferences(t *testing.T) { input = strings.NewReader(testPatchOrgPreferencesCmdBad) t.Run("Returns 400 with bad data", func(t *testing.T) { req := webtest.RequestWithSignedInUser(server.NewRequest(http.MethodPatch, patchOrgPreferencesUrl, input), &user.SignedInUser{ - OrgID: 1, - OrgRole: org.RoleAdmin, + OrgID: 1, + OrgRole: org.RoleAdmin, + Permissions: map[int64]map[string][]string{1: {accesscontrol.ActionOrgsPreferencesWrite: {}}}, }) response, err := server.SendJSON(req) require.NoError(t, err)