* Test basic persistence operations ... Create, Update, Delete.
*/
public void testPermissionsCRUD() throws Exception {
UserManager mgr = RollerFactory.getRoller().getUserManager();
PermissionsData perm = null;
// delete permissions
perm = mgr.getPermissions(testWeblog, testUser);
assertNotNull(perm);
mgr.removePermissions(perm);
TestUtils.endSession(true);
// check that delete was successful
perm = null;
perm = mgr.getPermissions(testWeblog, testUser);
assertNull(perm);
// create permissions
perm = new PermissionsData();
perm.setUser(testUser);
perm.setWebsite(testWeblog);
perm.setPending(false);
perm.setPermissionMask(PermissionsData.ADMIN);
mgr.savePermissions(perm);
TestUtils.endSession(true);
// check that create was successful
perm = null;
perm = mgr.getPermissions(testWeblog, testUser);
assertNotNull(perm);
assertEquals(PermissionsData.ADMIN, perm.getPermissionMask());
// update permissions
perm.setPermissionMask(PermissionsData.LIMITED);
mgr.savePermissions(perm);
TestUtils.endSession(true);
// check that update was successful
perm = null;
perm = mgr.getPermissions(testWeblog, testUser);
assertNotNull(perm);
assertEquals(PermissionsData.LIMITED, perm.getPermissionMask());
}