use of org.activityinfo.store.testing.NfiForm in project activityinfo by bedatadriven.
the class OperationFiltersTest method simpleRootFieldTest.
@Test
public void simpleRootFieldTest() {
NfiForm nfiForm = setup.getCatalog().getNfiForm();
FormTree formTree = setup.getCatalog().getFormTree(nfiForm.getFormId());
FormPermissions permissions = new FormPermissions.Builder().allowFilteredView(nfiForm.getVillageField().getId() + " == 'g12345'").allowFilteredEdit(nfiForm.getVillageField().getId() + "=='g12345'").build();
PermissionFilters filters = new PermissionFilters(formTree, permissions);
assertThat(filters.getReferenceBaseFilter(nfiForm.getVillageField().getId()).get().asExpression(), equalTo("[_id] == \"g12345\""));
}
Aggregations