fix(ee): clean up roles and users after review workflows API test

This commit is contained in:
Jamie Howard 2023-08-31 11:36:25 +01:00
parent 957f4df2d2
commit d71e6766be

View File

@ -648,8 +648,14 @@ describeOnCondition(edition === 'EE')('Review workflows', () => {
let utils;
let entry;
let restrictedRequest;
let restrictedUser;
let restrictedRole;
const deleteFixtures = async () => {
await utils.deleteUserById(restrictedUser.id);
await utils.deleteRolesById([restrictedRole.id]);
};
beforeAll(async () => {
// Update workflow to assign content type
await requests.admin.put(`/admin/review-workflows/workflows/${testWorkflow.id}?populate=*`, {
@ -658,24 +664,28 @@ describeOnCondition(edition === 'EE')('Review workflows', () => {
entry = await createEntry(productUID, { name: 'Product' });
const restrictedUser = {
email: 'restricted@user.io',
password: 'Restricted123',
};
utils = createUtils(strapi);
const role = await utils.createRole({
name: 'restricted-role',
description: '',
});
restrictedRole = role;
await utils.createUserIfNotExists({
...restrictedUser,
const restrictedUserInfo = {
email: 'restricted@user.io',
password: 'Restricted123',
};
restrictedUser = await utils.createUserIfNotExists({
...restrictedUserInfo,
roles: [role.id],
});
restrictedRole = role;
restrictedRequest = await createAuthRequest({ strapi, userInfo: restrictedUser });
restrictedRequest = await createAuthRequest({ strapi, userInfo: restrictedUserInfo });
});
afterAll(async () => {
await deleteFixtures();
});
test("It shouldn't be available for public", async () => {