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

126555 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      124248 gjames: RA-877: Copy api, return 422 instead of 500


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126901 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 12:08:15 +00:00
parent 0779769e84
commit 061e6a1662
3 changed files with 28 additions and 0 deletions

View File

@@ -1503,6 +1503,32 @@ public class NodeApiTest extends AbstractBaseApiTest
tgt.setTargetParentId(rootNodeId);
post("nodes/"+d1Id+"/copy", user1, toJsonAsStringNonNull(tgt), null, 403);
}
@Test
public void testCopySite() throws Exception
{
TestNetwork networkOne = getTestFixture().getRandomNetwork();
TestPerson cs1 = networkOne.createUser();
TestSite tSite = createSite(networkOne, cs1, SiteVisibility.PRIVATE);
// create folder
Folder folderResp = createFolder(cs1.getId(), Nodes.PATH_MY, "siteCopytarget");
String targetId = folderResp.getId();
Map<String, String> body = new HashMap<>();
body.put("targetParentId", targetId);
//test that you can't copy a site
post("nodes/"+tSite.getSiteInfo().getNodeRef().getId()+"/copy", cs1.getId(), toJsonAsStringNonNull(body), null, 422);
AuthenticationUtil.setFullyAuthenticatedUser(cs1.getId());
NodeRef docLibNodeRef = tSite.getContainerNodeRef("documentLibrary");
//test that you can't copy a site doclib
post("nodes/"+docLibNodeRef.getId()+"/copy", cs1.getId(), toJsonAsStringNonNull(body), null, 422);
}
/**
* Tests create folder.
* <p>POST:</p>