mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Expand calendar rest unit tests for ALF-8485
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32379 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -109,7 +109,7 @@ public class CalendarRestApiTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
// Create users
|
// Create users
|
||||||
createUser(USER_ONE, SiteModel.SITE_COLLABORATOR);
|
createUser(USER_ONE, SiteModel.SITE_COLLABORATOR);
|
||||||
createUser(USER_TWO, SiteModel.SITE_COLLABORATOR);
|
createUser(USER_TWO, SiteModel.SITE_CONSUMER);
|
||||||
|
|
||||||
// Do tests as inviter user
|
// Do tests as inviter user
|
||||||
this.authenticationComponent.setCurrentUser(USER_ONE);
|
this.authenticationComponent.setCurrentUser(USER_ONE);
|
||||||
@@ -420,6 +420,31 @@ public class CalendarRestApiTest extends BaseWebScriptTest
|
|||||||
assertEquals(true, permissions.getBoolean("delete"));
|
assertEquals(true, permissions.getBoolean("delete"));
|
||||||
|
|
||||||
|
|
||||||
|
// Switch users, will be able to see it still, but not edit
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_TWO);
|
||||||
|
entry = getEntry(name, Status.STATUS_OK);
|
||||||
|
|
||||||
|
assertEquals("Error found " + entry.toString(), false, entry.has("error"));
|
||||||
|
assertEquals(EVENT_TITLE_ONE, entry.getString("what"));
|
||||||
|
assertEquals(name, entry.getString("name"));
|
||||||
|
|
||||||
|
assertEquals("2011-06-29T12:00:00.000+01:00", entry.getJSONObject("startAt").get("iso8601"));
|
||||||
|
assertEquals("6/29/2011", entry.getJSONObject("startAt").get("legacyDate"));
|
||||||
|
assertEquals("12:00", entry.getJSONObject("startAt").get("legacyTime"));
|
||||||
|
assertEquals("2011-06-29T13:00:00.000+01:00", entry.getJSONObject("endAt").get("iso8601"));
|
||||||
|
assertEquals("6/29/2011", entry.getJSONObject("endAt").get("legacyDate"));
|
||||||
|
assertEquals("13:00", entry.getJSONObject("endAt").get("legacyTime"));
|
||||||
|
|
||||||
|
// Check the other user sees different permissions
|
||||||
|
assertEquals(true, entry.has("permissions"));
|
||||||
|
permissions = entry.getJSONObject("permissions");
|
||||||
|
assertEquals(false, permissions.getBoolean("edit"));
|
||||||
|
assertEquals(false, permissions.getBoolean("delete"));
|
||||||
|
|
||||||
|
// Back to the main user for more tests
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_ONE);
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
entry = updateEntry(name, EVENT_TITLE_ONE, "More Where", "More Thing", false, Status.STATUS_OK);
|
entry = updateEntry(name, EVENT_TITLE_ONE, "More Where", "More Thing", false, Status.STATUS_OK);
|
||||||
assertEquals("Error found " + entry.toString(), false, entry.has("error"));
|
assertEquals("Error found " + entry.toString(), false, entry.has("error"));
|
||||||
|
Reference in New Issue
Block a user