test(f4): align legacy contracts with lifecycle model
This commit is contained in:
@@ -13,40 +13,16 @@ function permissionFor(controller: object, method: string): string[] {
|
||||
return Reflect.getMetadata(REQUIRED_PERMISSIONS_KEY, handler) as string[];
|
||||
}
|
||||
|
||||
test('finding endpoints separate catalog, content, follow-up and closure permissions', () => {
|
||||
assert.deepEqual(permissionFor(FindingCatalogController.prototype, 'list'), [
|
||||
'finding_catalog.read',
|
||||
]);
|
||||
for (const method of [
|
||||
'adminList',
|
||||
'createCategory',
|
||||
'updateCategory',
|
||||
'createItem',
|
||||
'updateItem',
|
||||
]) {
|
||||
assert.deepEqual(permissionFor(FindingCatalogController.prototype, method), [
|
||||
'finding_catalog.manage',
|
||||
]);
|
||||
test('F4 finding endpoints separate catalog, content and closure while mutable follow-up is retired', () => {
|
||||
assert.deepEqual(permissionFor(FindingCatalogController.prototype, 'list'), ['finding_catalog.read']);
|
||||
for (const method of ['adminList', 'createCategory', 'updateCategory', 'createItem', 'updateItem']) {
|
||||
assert.deepEqual(permissionFor(FindingCatalogController.prototype, method), ['finding_catalog.manage']);
|
||||
}
|
||||
assert.deepEqual(permissionFor(InspectionActFindingsController.prototype, 'list'), [
|
||||
'inspection_findings.read',
|
||||
]);
|
||||
assert.deepEqual(permissionFor(InspectionActFindingsController.prototype, 'create'), [
|
||||
'inspection_findings.create',
|
||||
]);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'list'), [
|
||||
'inspection_findings.read',
|
||||
]);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'get'), [
|
||||
'inspection_findings.read',
|
||||
]);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'update'), [
|
||||
'inspection_findings.update',
|
||||
]);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'updateFollowUp'), [
|
||||
'inspection_findings.follow_up',
|
||||
]);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'close'), [
|
||||
'inspection_findings.close',
|
||||
]);
|
||||
assert.deepEqual(permissionFor(InspectionActFindingsController.prototype, 'list'), ['inspection_findings.read']);
|
||||
assert.deepEqual(permissionFor(InspectionActFindingsController.prototype, 'create'), ['inspection_findings.create']);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'list'), ['inspection_findings.read']);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'get'), ['inspection_findings.read']);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'update'), ['inspection_findings.update']);
|
||||
assert.equal('updateFollowUp' in InspectionFindingsController.prototype, false);
|
||||
assert.deepEqual(permissionFor(InspectionFindingsController.prototype, 'close'), ['inspection_findings.close']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user