Search in sources :

Example 1 with NfiForm

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\""));
}
Also used : FormPermissions(org.activityinfo.model.form.FormPermissions) FormTree(org.activityinfo.model.formTree.FormTree) NfiForm(org.activityinfo.store.testing.NfiForm) Test(org.junit.Test)

Aggregations

FormPermissions (org.activityinfo.model.form.FormPermissions)1 FormTree (org.activityinfo.model.formTree.FormTree)1 NfiForm (org.activityinfo.store.testing.NfiForm)1 Test (org.junit.Test)1