Merged HEAD (5.2) to 5.2.N (5.2.1)

126524 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      123056 jvonka: (Quick) Shared Links API - find links (fix 500 -> 401 if not authenticated)
      - add more -ve tests to check methods that require auth return 401 if unauthenticated
      RA-777


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126868 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 11:59:04 +00:00
parent 04d203e507
commit b8daf2457b
2 changed files with 38 additions and 14 deletions

View File

@@ -268,8 +268,6 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
assertEquals("attachment; filename=\"" + fileName1 + "\"; filename*=UTF-8''" + fileName1 + "", response.getHeaders().get("Content-Disposition"));
response = getSingle(QuickShareLinkEntityResource.class, null, shared1Id + "/content", null, 30);
// -ve test - unauth access to get shared link file content - without Content-Disposition header (attachment=false) - header ignored (plain text is not in white list)
params = new HashMap<>();
params.put("attachment", "false");
@@ -336,6 +334,9 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
// -ve test - user1 cannot delete shared link
delete(URL_SHARED_LINKS, user1, shared1Id, 403);
// -ve test - unauthenticated
delete(URL_SHARED_LINKS, null, shared1Id, 401);
// -ve test - delete - cannot delete non-existent link
delete(URL_SHARED_LINKS, user1, "dummy", 404);
}
@@ -346,6 +347,8 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
// As user 1 ...
// -ve test - try to create again (different user, that has read permission) - already exists
body = new HashMap<>();
body.put("nodeId", d1Id);
post(URL_SHARED_LINKS, user1, toJsonAsStringNonNull(body), 409);
// -ve - create - missing nodeId
@@ -367,6 +370,11 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
body = new HashMap<>();
body.put("nodeId", d2Id);
post(URL_SHARED_LINKS, user2, toJsonAsStringNonNull(body), 403);
// -ve test - unauthenticated
body = new HashMap<>();
body.put("nodeId", d1Id);
post(URL_SHARED_LINKS, null, toJsonAsStringNonNull(body), 401);
}
@@ -510,6 +518,10 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
assertEquals(d2Id, sharedLinks.get(0).getNodeId());
// -ve test - unauthenticated
getAll(URL_SHARED_LINKS, null, paging, params, 401);
// delete the shared links
delete(URL_SHARED_LINKS, user1, shared1Id, 204);
delete(URL_SHARED_LINKS, user2, shared2Id, 204);