From 5391944f6ec535f0d8eb2a2a64afb3efb19e6137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Wed, 27 Jul 2022 15:46:42 +0200 Subject: [PATCH] Fix permission clone tests failing due to endpoint refactor --- tests/system/permissions_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/system/permissions_test.go b/tests/system/permissions_test.go index 921c1f82c..67e04426e 100644 --- a/tests/system/permissions_test.go +++ b/tests/system/permissions_test.go @@ -2,15 +2,16 @@ package system import ( "fmt" - "github.com/cortezaproject/corteza-server/pkg/id" "net/http" "strconv" "testing" + "github.com/cortezaproject/corteza-server/pkg/id" + jsonpath "github.com/steinfletcher/apitest-jsonpath" + "github.com/cortezaproject/corteza-server/pkg/rbac" "github.com/cortezaproject/corteza-server/system/types" "github.com/cortezaproject/corteza-server/tests/helpers" - "github.com/steinfletcher/apitest-jsonpath" ) func TestPermissionsEffective(t *testing.T) { @@ -199,7 +200,7 @@ func TestPermissionsCloneToSingleRole(t *testing.T) { h.a.Len(p.FindRulesByRoleID(roleT), 2) h.apiInit(). - Post(fmt.Sprintf("/permissions/%d/rules/clone", roleS)). + Post(fmt.Sprintf("/roles/%d/rules/clone", roleS)). Query("cloneToRoleID", strconv.FormatUint(roleT, 10)). Header("Accept", "application/json"). Expect(t). @@ -244,7 +245,7 @@ func TestPermissionsCloneToMultipleRole(t *testing.T) { h.a.Len(p.FindRulesByRoleID(roleY), 3) h.apiInit(). - Post(fmt.Sprintf("/permissions/%d/rules/clone", roleS)). + Post(fmt.Sprintf("/roles/%d/rules/clone", roleS)). Query("cloneToRoleID", strconv.FormatUint(roleT, 10)). Query("cloneToRoleID", strconv.FormatUint(roleY, 10)). Header("Accept", "application/json"). @@ -282,11 +283,11 @@ func TestPermissionsCloneNotAllowed(t *testing.T) { h.a.Len(p.FindRulesByRoleID(roleT), 2) h.apiInit(). - Post(fmt.Sprintf("/permissions/%d/rules/clone", roleS)). + Post(fmt.Sprintf("/roles/%d/rules/clone", roleS)). Header("Accept", "application/json"). FormData("cloneToRoleID", strconv.FormatUint(roleT, 10)). Expect(t). Status(http.StatusOK). - Assert(helpers.AssertError("accessControl.errors.notAllowedToSetPermissions")). + Assert(helpers.AssertError("role.errors.notAllowedToCloneRules")). End() }