[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:
@@ -84,10 +84,23 @@ define(
|
||||
describe("defers to policyService", function () {
|
||||
beforeEach(function () {
|
||||
object.id = 'abc';
|
||||
object.capabilities.type = { type: 'object' };
|
||||
parentCandidate.id = 'xyz';
|
||||
parentCandidate.capabilities.type = {
|
||||
type: 'parentCandidate'
|
||||
};
|
||||
parentCandidate.model.composition = [];
|
||||
});
|
||||
|
||||
it("calls policy service with correct args", function () {
|
||||
validate();
|
||||
expect(mockPolicyService.allow).toHaveBeenCalledWith(
|
||||
"composition",
|
||||
parentCandidate.capabilities.type,
|
||||
object.capabilities.type
|
||||
);
|
||||
});
|
||||
|
||||
it("and returns false", function () {
|
||||
mockPolicyService.allow.andReturn(true);
|
||||
expect(validate()).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user