done(newError("But it returned something else!"));
}
});
});
});
describe(".list_resources",function(){
it("should throw a proper error when trying to list instances of resource type with a shallow access_strategy that disallows the context",function(done){
varrt=newSealious.Collection({
fields:[{name:"value",type:"text"}],
access_strategy:newSealious.AccessStrategyType({
checker_function:function(context){
if(context.user_id==1){
returnPromise.reject("User 1 cannot access this resource");
}
}
})
});
varsubject=newCollectionSubject(rt);
varcontext=newSealious.Context(0,null,1);
varresult=subject.perform_action(context,"show");
assert_error_type(result,"permission",done);
});
it("should only show resources that are allowed by the resource-type's deep item-sensitive access strategy",function(done){