diff --git a/packages/server/src/api/routes/tests/permissions.spec.ts b/packages/server/src/api/routes/tests/permissions.spec.ts index b3fbd46799..118d35f8fd 100644 --- a/packages/server/src/api/routes/tests/permissions.spec.ts +++ b/packages/server/src/api/routes/tests/permissions.spec.ts @@ -39,7 +39,11 @@ describe("/permission", () => { table = (await config.createTable()) as typeof table row = await config.createRow() - perms = await config.addPermission(STD_ROLE_ID, table._id) + perms = await config.api.permission.set({ + roleId: STD_ROLE_ID, + resourceId: table._id, + level: PermissionLevel.READ, + }) }) describe("levels", () => { @@ -74,11 +78,11 @@ describe("/permission", () => { }) it("should get resource permissions with multiple roles", async () => { - perms = await config.addPermission( - HIGHER_ROLE_ID, - table._id, - PermissionLevel.WRITE - ) + perms = await config.api.permission.set({ + roleId: HIGHER_ROLE_ID, + resourceId: table._id, + level: PermissionLevel.WRITE, + }) const res = await config.api.permission.get(table._id) expect(res.body["read"]).toEqual(STD_ROLE_ID) expect(res.body["write"]).toEqual(HIGHER_ROLE_ID) diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index 5522af347e..c1db54fe60 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -50,7 +50,6 @@ import { SearchFilters, UserRoles, Automation, - PermissionLevel, } from "@budibase/types" import { BUILTIN_ROLE_IDS } from "@budibase/backend-core/src/security/roles" @@ -621,22 +620,6 @@ class TestConfiguration { return this._req(config, null, controllers.role.save) } - async addPermission( - roleId: string, - resourceId: string, - level = PermissionLevel.READ - ) { - return this._req( - null, - { - roleId, - resourceId, - level, - }, - controllers.perms.addPermission - ) - } - // VIEW async createView(config?: any) {