mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
127571 jkaabimofrad: Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2) 126242 gjames: RA-878:All api errors should return the standard error object git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@127665 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,11 +36,14 @@ 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.apache.commons.httpclient.HttpStatus;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Basic modulepackages api calls
|
||||
@@ -89,6 +92,26 @@ public class ModulePackagesApiTest extends AbstractBaseApiTest
|
||||
assertTrue("Simple module must be the correct version","1.0.0-SNAPSHOT".equals(simpleModule.getVersion().toString()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testErrorUrls() throws Exception
|
||||
{
|
||||
publicApiClient.setRequestContext(new RequestContext(null));
|
||||
Map<String, String> params = createParams(null, null);
|
||||
|
||||
//Call an endpoint that doesn't exist
|
||||
HttpResponse response = publicApiClient.get(getScope(), MODULEPACKAGES+"/fred/blogs/king/kong/got/if/wrong", null, null, null, params);
|
||||
assertNotNull(response);
|
||||
assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatusCode());
|
||||
assertEquals("no-cache", response.getHeaders().get("Cache-Control"));
|
||||
assertEquals("application/json;charset=UTF-8", response.getHeaders().get("Content-Type"));
|
||||
|
||||
PublicApiClient.ExpectedErrorResponse errorResponse = RestApiUtil.parseErrorResponse(response.getJsonResponse());
|
||||
assertNotNull(errorResponse);
|
||||
assertNotNull(errorResponse.getErrorKey());
|
||||
assertNotNull(errorResponse.getBriefSummary());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScope()
|
||||
{
|
||||
|
Reference in New Issue
Block a user