[Entanglement] Correctly Call Policy Service
Move, Copy, and Link services correctly call the policy service to check whether composition is allowed. Fixes open-1254.
This commit is contained in:
@@ -60,10 +60,16 @@ define(
|
||||
policyService
|
||||
);
|
||||
object = domainObjectFactory({
|
||||
name: 'object'
|
||||
name: 'object',
|
||||
capabilities: {
|
||||
type: { type: 'object' }
|
||||
}
|
||||
});
|
||||
parentCandidate = domainObjectFactory({
|
||||
name: 'parentCandidate'
|
||||
name: 'parentCandidate',
|
||||
capabilities: {
|
||||
type: { type: 'parentCandidate' }
|
||||
}
|
||||
});
|
||||
validate = function () {
|
||||
return copyService.validate(object, parentCandidate);
|
||||
@@ -88,6 +94,15 @@ define(
|
||||
parentCandidate.id = 'b';
|
||||
});
|
||||
|
||||
it("calls policy service with correct args", function () {
|
||||
validate();
|
||||
expect(policyService.allow).toHaveBeenCalledWith(
|
||||
"composition",
|
||||
parentCandidate.capabilities.type,
|
||||
object.capabilities.type
|
||||
);
|
||||
});
|
||||
|
||||
it("and returns false", function () {
|
||||
policyService.allow.andReturn(false);
|
||||
expect(validate()).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user