Skip to content

Commit

Permalink
Test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
elena-shostak committed Oct 31, 2024
1 parent 2c317d6 commit b1246e6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('GET all roles by space id', () => {

const paramsSchema = (config.validate as any).params;

expect(config.options).toEqual({ tags: ['access:manage_spaces'] });
expect(config.security?.authz).toEqual({ requiredPrivileges: ['manage_spaces'] });
expect(() => paramsSchema.validate({})).toThrowErrorMatchingInlineSnapshot(
`"[spaceId]: expected value of type [string] but got [undefined]"`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ describe('Invalidate sessions routes', () => {
expect(routeConfig.options).toEqual({
access: 'public',
summary: 'Invalidate user sessions',
tags: ['access:sessionManagement'],
});

expect(routeConfig.security?.authz).toEqual({ requiredPrivileges: ['sessionManagement'] });

const bodySchema = (routeConfig.validate as any).body as ObjectType;
expect(() => bodySchema.validate({})).toThrowErrorMatchingInlineSnapshot(
`"[match]: expected at least one defined value but got [undefined]"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Bulk get profile routes', () => {
});

it('correctly defines route.', () => {
expect(routeConfig.options).toEqual({ tags: ['access:bulkGetUserProfiles'] });
expect(routeConfig.security?.authz).toEqual({ requiredPrivileges: ['bulkGetUserProfiles'] });

const bodySchema = (routeConfig.validate as any).body as ObjectType;
expect(() => bodySchema.validate(0)).toThrowErrorMatchingInlineSnapshot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('GET /internal/spaces/{spaceId}/content_summary', () => {

const paramsSchema = (config.validate as any).params;

expect(config.options).toEqual({ tags: ['access:manage_spaces'] });
expect(config.security?.authz).toEqual({ requiredPrivileges: ['manage_spaces'] });
expect(() => paramsSchema.validate({})).toThrowErrorMatchingInlineSnapshot(
`"[spaceId]: expected value of type [string] but got [undefined]"`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
expect(resp.body).to.eql({
statusCode: 403,
error: 'Forbidden',
message: 'Forbidden',
message:
'API [POST /api/spaces/_copy_saved_objects] is unauthorized for user, this action is granted by the Kibana privileges [copySavedObjectsToSpaces]',
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ export function resolveCopyToSpaceConflictsSuite(context: FtrProviderContext) {
expect(resp.body).to.eql({
statusCode: 403,
error: 'Forbidden',
message: 'Forbidden',
message:
'API [POST /api/spaces/_resolve_copy_saved_objects_errors] is unauthorized for user, this action is granted by the Kibana privileges [copySavedObjectsToSpaces]',
});
};

Expand Down

0 comments on commit b1246e6

Please sign in to comment.