use of org.activityinfo.shared.command.result.UserResult in project activityinfo by bedatadriven.
the class GetUsersTest method testUnsorted.
@Test
public void testUnsorted() throws CommandException {
setUser(DATABASE_OWNER);
GetUsers cmd = new GetUsers(1);
UserResult result = execute(cmd);
Assert.assertEquals(3, result.getData().size());
}
use of org.activityinfo.shared.command.result.UserResult in project activityinfo by bedatadriven.
the class GetUsersTest method testManageUsersPermission.
/**
* Verify that users with ManageUsers permission can get a list of users
* within their organisation
*/
@Test
public void testManageUsersPermission() throws CommandException {
// populate with a known state and authenticate as user 3, who
// has ManageUser permissions for Solidarites
// Lisa from Solidarites
setUser(3);
// execute
UserResult result = execute(new GetUsers(1));
// VERIFY that we have 1 result:
// - the one other solidarites user
Assert.assertEquals("number of results", 1, result.getTotalLength());
Assert.assertEquals("user name", "Marlene", result.getData().get(0).getName());
}
use of org.activityinfo.shared.command.result.UserResult 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