use of org.activityinfo.shared.command.GetUsers 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