Use extracted functions
This commit is contained in:
parent
d8473b4a23
commit
e4feb64fe5
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue