Merge pull request #13234 from Budibase/test/removing-account-holder
Add test, account holder cannot be removed
This commit is contained in:
commit
efe07cef5d
|
@ -2,6 +2,7 @@ import tk from "timekeeper"
|
||||||
import _ from "lodash"
|
import _ from "lodash"
|
||||||
import { generator, mocks, structures } from "@budibase/backend-core/tests"
|
import { generator, mocks, structures } from "@budibase/backend-core/tests"
|
||||||
import {
|
import {
|
||||||
|
CloudAccount,
|
||||||
ScimCreateUserRequest,
|
ScimCreateUserRequest,
|
||||||
ScimGroupResponse,
|
ScimGroupResponse,
|
||||||
ScimUpdateRequest,
|
ScimUpdateRequest,
|
||||||
|
@ -604,6 +605,25 @@ describe("scim", () => {
|
||||||
|
|
||||||
expect(events.user.deleted).toBeCalledTimes(1)
|
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 })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
import TestConfiguration from "../../TestConfiguration"
|
import TestConfiguration from "../../TestConfiguration"
|
||||||
import { TestAPI } from "../base"
|
import { TestAPI } from "../base"
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig: RequestSettings = {
|
||||||
expect: 200,
|
expect: 200,
|
||||||
setHeaders: true,
|
setHeaders: true,
|
||||||
skipContentTypeCheck: false,
|
skipContentTypeCheck: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RequestSettings = typeof defaultConfig
|
export type RequestSettings = {
|
||||||
|
expect: number | object
|
||||||
|
setHeaders: boolean
|
||||||
|
skipContentTypeCheck: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export abstract class ScimTestAPI extends TestAPI {
|
export abstract class ScimTestAPI extends TestAPI {
|
||||||
constructor(config: TestConfiguration) {
|
constructor(config: TestConfiguration) {
|
||||||
|
|
Loading…
Reference in New Issue