Merge pull request #13234 from Budibase/test/removing-account-holder

Add test, account holder cannot be removed
This commit is contained in:
Adria Navarro 2024-03-12 11:20:12 +01:00 committed by GitHub
commit efe07cef5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import tk from "timekeeper"
import _ from "lodash"
import { generator, mocks, structures } from "@budibase/backend-core/tests"
import {
CloudAccount,
ScimCreateUserRequest,
ScimGroupResponse,
ScimUpdateRequest,
@ -604,6 +605,25 @@ describe("scim", () => {
expect(events.user.deleted).toBeCalledTimes(1)
})
it("an account holder cannot be removed even when synched", async () => {
const account: CloudAccount = {
...structures.accounts.account(),
budibaseUserId: user.id,
email: user.emails![0].value,
}
mocks.accounts.getAccount.mockResolvedValue(account)
await deleteScimUser(user.id, {
expect: {
message: "Account holder cannot be deleted",
status: 400,
error: { code: "http" },
},
})
await config.api.scimUsersAPI.find(user.id, { expect: 200 })
})
})
})

View File

@ -1,13 +1,17 @@
import TestConfiguration from "../../TestConfiguration"
import { TestAPI } from "../base"
const defaultConfig = {
const defaultConfig: RequestSettings = {
expect: 200,
setHeaders: true,
skipContentTypeCheck: false,
}
export type RequestSettings = typeof defaultConfig
export type RequestSettings = {
expect: number | object
setHeaders: boolean
skipContentTypeCheck: boolean
}
export abstract class ScimTestAPI extends TestAPI {
constructor(config: TestConfiguration) {