Skip to content

Commit

Permalink
added default role as data consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaileshParmar11 committed Sep 11, 2024
1 parent 08ec09b commit 4c83854
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,6 @@ entities.forEach((EntityClass) => {

await user.create(apiContext);

const dataConsumerRoleResponse = await apiContext.get(
'/api/v1/roles/name/DataConsumer'
);

const dataConsumerRole = await dataConsumerRoleResponse.json();

await user.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/roles/0',
value: {
id: dataConsumerRole.id,
type: 'role',
name: dataConsumerRole.name,
},
},
],
});

await EntityDataClass.preRequisitesForTests(apiContext);
await entity.create(apiContext);
await afterAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ export class UserClass {
}

async create(apiContext: APIRequestContext) {
const dataConsumerRoleResponse = await apiContext.get(
'/api/v1/roles/name/DataConsumer'
);

const dataConsumerRole = await dataConsumerRoleResponse.json();

const response = await apiContext.post('/api/v1/users/signup', {
data: this.data,
data: { ...this.data, roles: [dataConsumerRole.id] },
});

this.responseData = await response.json();
Expand Down

0 comments on commit 4c83854

Please sign in to comment.