mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1)
128608 jvonka: V1 REST API: cleanup and rationalise new api tests (re: remotable helpers & runAs user / admin) - round 4 REPO-113 (also relates to REPO-28, REPO-114, REPO-825) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129178 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,7 +36,6 @@ import static org.junit.Assert.assertTrue;
|
||||
import org.alfresco.rest.api.model.ModulePackage;
|
||||
import org.alfresco.rest.api.tests.client.HttpResponse;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiClient;
|
||||
import org.alfresco.rest.api.tests.client.RequestContext;
|
||||
import org.alfresco.rest.api.tests.util.RestApiUtil;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
@@ -50,6 +49,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Basic modulepackages api calls
|
||||
*
|
||||
* @author Gethin James.
|
||||
*/
|
||||
public class ModulePackagesApiTest extends AbstractBaseApiTest
|
||||
@@ -78,7 +78,9 @@ public class ModulePackagesApiTest extends AbstractBaseApiTest
|
||||
@Test
|
||||
public void testAllModulePackages() throws Exception
|
||||
{
|
||||
HttpResponse response = getAll(MODULEPACKAGES, nonAdminUserName, null, HttpStatus.SC_OK);
|
||||
setRequestContext(nonAdminUserName);
|
||||
|
||||
HttpResponse response = getAll(MODULEPACKAGES, null, HttpStatus.SC_OK);
|
||||
assertNotNull(response);
|
||||
|
||||
PublicApiClient.ExpectedPaging paging = parsePaging(response.getJsonResponse());
|
||||
@@ -96,10 +98,12 @@ public class ModulePackagesApiTest extends AbstractBaseApiTest
|
||||
@Test
|
||||
public void testSingleModulePackage() throws Exception
|
||||
{
|
||||
HttpResponse response = getSingle(MODULEPACKAGES, nonAdminUserName, "NonSENSE_NOTFOUND", HttpStatus.SC_NOT_FOUND);
|
||||
setRequestContext(nonAdminUserName);
|
||||
|
||||
HttpResponse response = getSingle(MODULEPACKAGES, "NonSENSE_NOTFOUND", HttpStatus.SC_NOT_FOUND);
|
||||
assertNotNull(response);
|
||||
|
||||
response = getSingle(MODULEPACKAGES, nonAdminUserName, "alfresco-simple-module", HttpStatus.SC_OK);
|
||||
response = getSingle(MODULEPACKAGES, "alfresco-simple-module", HttpStatus.SC_OK);
|
||||
assertNotNull(response);
|
||||
|
||||
ModulePackage simpleModule = parseRestApiEntry(response.getJsonResponse(),ModulePackage.class);
|
||||
@@ -111,7 +115,8 @@ public class ModulePackagesApiTest extends AbstractBaseApiTest
|
||||
@Test
|
||||
public void testErrorUrls() throws Exception
|
||||
{
|
||||
publicApiClient.setRequestContext(new RequestContext(null));
|
||||
setRequestContext(null);
|
||||
|
||||
Map<String, String> params = createParams(null, null);
|
||||
|
||||
//Call an endpoint that doesn't exist
|
||||
|
Reference in New Issue
Block a user