use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class UpdateUserPermissionsHandlerTest method testFolderLevelUpdate.
@Test
@OnDataSet("/dbunit/schema3.db.xml")
public void testFolderLevelUpdate() {
setUser(1);
UserPermissionDTO newUser = new UserPermissionDTO();
newUser.setName("Bavon");
newUser.setEmail("bavon@nrcdrc.org");
newUser.setPartner(new PartnerDTO(1, "NRC"));
newUser.setAllowView(true);
newUser.setAllowViewAll(false);
newUser.setAllowEdit(true);
newUser.setAllowEdit(false);
newUser.setAllowDesign(true);
FolderDTO health = new FolderDTO();
health.setId(3);
newUser.setFolders(Arrays.asList(health));
newUser.setFolderLimitation(true);
execute(new UpdateUserPermissions(1, newUser));
UserResult users = execute(new GetUsers(1));
UserPermissionDTO bavon = users.getData().get(0);
assertThat(bavon.hasFolderLimitation(), equalTo(true));
}
use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class PartnerTest method testAddNewPartner.
@Test
public void testAddNewPartner() throws Exception {
PartnerDTO newPartner = new PartnerDTO();
newPartner.setName("VDE");
newPartner.setFullName("Vision d'Espoir");
CreateResult cr = execute(new UpdatePartner(1, newPartner));
SchemaDTO schema = execute(new GetSchema());
PartnerDTO partner = schema.getDatabaseById(1).getPartnerById(cr.getNewId());
Assert.assertNotNull(partner);
Assert.assertEquals("VDE", partner.getName());
Assert.assertEquals("Vision d'Espoir", partner.getFullName());
}
use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class PartnerTest method testAddDuplicatePartner.
public void testAddDuplicatePartner() throws Exception {
PartnerDTO newPartner = new PartnerDTO();
newPartner.setName("NRC");
newPartner.setFullName("Norweigen Refugee Committe");
CreateResult cr = execute(new UpdatePartner(1, newPartner));
Assert.assertTrue(cr instanceof DuplicateCreateResult);
}
Aggregations