[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:
@@ -65,7 +65,8 @@ define(
|
||||
name: 'object',
|
||||
id: 'a',
|
||||
capabilities: {
|
||||
context: objectContextCapability
|
||||
context: objectContextCapability,
|
||||
type: { type: 'object' }
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,8 +79,11 @@ define(
|
||||
|
||||
parentCandidate = domainObjectFactory({
|
||||
name: 'parentCandidate',
|
||||
model: {composition: []},
|
||||
id: 'c'
|
||||
model: { composition: [] },
|
||||
id: 'c',
|
||||
capabilities: {
|
||||
type: { type: 'parentCandidate' }
|
||||
}
|
||||
});
|
||||
|
||||
validate = function () {
|
||||
@@ -112,6 +116,15 @@ define(
|
||||
|
||||
describe("defers to policyService", function () {
|
||||
|
||||
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