mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
130871 jvonka: REPO-1027: V1 REST API - fix error handling (add site member) - fix error code (should be 400 not 500) & add -ve api tests - ACE-5458 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132196 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -61,6 +61,7 @@ import org.junit.Test;
|
||||
public class TestSiteMembers extends EnterpriseTestApi
|
||||
{
|
||||
// TODO set create member for a user who is a member of the site (not the creator)
|
||||
// TODO split into more manageable test methods
|
||||
@Test
|
||||
public void testSiteMembers() throws Exception
|
||||
{
|
||||
@@ -382,6 +383,30 @@ public class TestSiteMembers extends EnterpriseTestApi
|
||||
{
|
||||
assertEquals(e.getMessage(), HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
|
||||
// missing person id
|
||||
try
|
||||
{
|
||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2.getId()));
|
||||
sitesProxy.createSiteMember(site.getSiteId(), new SiteMember(null, SiteRole.SiteContributor.toString()));
|
||||
fail("");
|
||||
}
|
||||
catch(PublicApiException e)
|
||||
{
|
||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
|
||||
// missing role
|
||||
try
|
||||
{
|
||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2.getId()));
|
||||
sitesProxy.createSiteMember(site.getSiteId(), new SiteMember(person1.getId(), null));
|
||||
fail("");
|
||||
}
|
||||
catch(PublicApiException e)
|
||||
{
|
||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
|
||||
// check site membership in GET
|
||||
List<SiteMember> expectedSiteMembers = site.getMembers();
|
||||
|
Reference in New Issue
Block a user