assertEquals(true, isAllowed);
}
public void testCanExecuteDeleteAction() throws IQserSecurityException{
Content content;
String action;
boolean isAllowed;
//attribute is present
String[] attribuetNames = new String[]{"from_id","owner_id"};
for (String name : attribuetNames) {
content = new Content();
content.addAttribute(new Attribute(name, "100", Attribute.ATTRIBUTE_TYPE_TEXT));
action = FacebookContentProvider.ACTION_DELETE;
isAllowed = securityFilter.canExecuteAction(user, password, action, content);
assertEquals(true, isAllowed);
}
//attribute is present , wrong value
content = new Content();
content.addAttribute(new Attribute("from_id", "123", Attribute.ATTRIBUTE_TYPE_TEXT));
action = FacebookContentProvider.ACTION_DELETE;
isAllowed = securityFilter.canExecuteAction(user, password, action, content);
assertEquals(false, isAllowed);
//no attributes
content = new Content();
action = FacebookContentProvider.ACTION_DELETE;
isAllowed = securityFilter.canExecuteAction(user, password, action, content);
assertEquals(false, isAllowed);
}