mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
chore: patch scim tests to allow for deleting a scim user
This commit is contained in:
parent
5c5d48db1e
commit
666b64e288
@ -12,6 +12,7 @@ let app: IUnleashTest;
|
|||||||
|
|
||||||
let scimUserId: number;
|
let scimUserId: number;
|
||||||
let regularUserId: number;
|
let regularUserId: number;
|
||||||
|
let scimDeletableUser: number;
|
||||||
|
|
||||||
const scimUser = {
|
const scimUser = {
|
||||||
email: 'scim-user@test.com',
|
email: 'scim-user@test.com',
|
||||||
@ -24,6 +25,12 @@ const regularUser = {
|
|||||||
name: 'Regular User',
|
name: 'Regular User',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const scimUserToBeDeleted = {
|
||||||
|
email: 'scim-victim@test.com',
|
||||||
|
name: 'SCIM Victim',
|
||||||
|
scim_id: 'some-other-random-scim-id',
|
||||||
|
};
|
||||||
|
|
||||||
const scimGuardErrorMessage =
|
const scimGuardErrorMessage =
|
||||||
'This user is managed by your SCIM provider and cannot be changed manually';
|
'This user is managed by your SCIM provider and cannot be changed manually';
|
||||||
|
|
||||||
@ -50,6 +57,13 @@ beforeAll(async () => {
|
|||||||
regularUserId = (
|
regularUserId = (
|
||||||
await db.rawDatabase('users').insert(regularUser).returning('id')
|
await db.rawDatabase('users').insert(regularUser).returning('id')
|
||||||
)[0].id;
|
)[0].id;
|
||||||
|
|
||||||
|
scimDeletableUser = (
|
||||||
|
await db
|
||||||
|
.rawDatabase('users')
|
||||||
|
.insert(scimUserToBeDeleted)
|
||||||
|
.returning('id')
|
||||||
|
)[0].id;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
@ -86,12 +100,10 @@ test('should prevent editing a SCIM user', async () => {
|
|||||||
expect(body.details[0].message).toBe(scimGuardErrorMessage);
|
expect(body.details[0].message).toBe(scimGuardErrorMessage);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should prevent deleting a SCIM user', async () => {
|
test('should not prevent deleting a SCIM user', async () => {
|
||||||
const { body } = await app.request
|
await app.request
|
||||||
.delete(`/api/admin/user-admin/${scimUserId}`)
|
.delete(`/api/admin/user-admin/${scimDeletableUser}`)
|
||||||
.expect(403);
|
.expect(200);
|
||||||
|
|
||||||
expect(body.details[0].message).toBe(scimGuardErrorMessage);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should prevent changing password for a SCIM user', async () => {
|
test('should prevent changing password for a SCIM user', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user