use of org.activityinfo.shared.dto.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 AddPartner(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.shared.dto.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 AddPartner(1, newPartner));
Assert.assertTrue(cr instanceof DuplicateCreateResult);
}
use of org.activityinfo.shared.dto.PartnerDTO in project activityinfo by bedatadriven.
the class UpdateUserPermissionsHandlerTest method testAuthorizedCreate.
/**
* Verifies that a user with the manageUsers permission can add another user to the UserDatabase
*
* @throws CommandException
*/
@Test
@OnDataSet("/dbunit/schema1.db.xml")
public void testAuthorizedCreate() throws CommandException {
setUser(2);
UserPermissionDTO user = new UserPermissionDTO();
user.setEmail("ralph@lauren.com");
user.setName("Ralph");
user.setPartner(new PartnerDTO(1, "NRC"));
user.setAllowView(true);
user.setAllowEdit(true);
UpdateUserPermissions cmd = new UpdateUserPermissions(1, user);
execute(cmd);
UserResult result = execute(new GetUsers(1));
Assert.assertEquals(1, result.getTotalLength());
Assert.assertEquals("ralph@lauren.com", result.getData().get(0).getEmail());
Assert.assertTrue("edit permissions", result.getData().get(0).getAllowEdit());
}
Aggregations