mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
TAS-2043
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
package org.alfresco.rest.sites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.ContainerName;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
public class GetSiteContainerCoreTests extends RestTest{
|
||||
|
||||
private UserModel adminUserModel, testUserModel;
|
||||
private SiteModel publicSiteWithContainers;
|
||||
private SiteModel moderatedSiteModel, privateSiteModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
testUserModel = dataUser.createRandomTestUser();
|
||||
publicSiteWithContainers = dataSite.usingAdmin().createPublicRandomSite();
|
||||
moderatedSiteModel = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
privateSiteModel = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
dataLink.usingAdmin().usingSite(publicSiteWithContainers).createRandomLink();
|
||||
dataDiscussion.usingAdmin().usingSite(publicSiteWithContainers).createRandomDiscussion();
|
||||
|
||||
dataLink.usingAdmin().usingSite(moderatedSiteModel).createRandomLink();
|
||||
dataDiscussion.usingAdmin().usingSite(moderatedSiteModel).createRandomDiscussion();
|
||||
|
||||
dataLink.usingAdmin().usingSite(privateSiteModel).createRandomLink();
|
||||
dataDiscussion.usingAdmin().usingSite(privateSiteModel).createRandomDiscussion();
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get container request returns status code 400 when site doesn't exist")
|
||||
public void getContainerWithNonExistentSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(testUserModel)
|
||||
.withCoreAPI().usingSite("NonExistentSiteId").getSiteContainer(ContainerName.discussions.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, "NonExistentSiteId", ContainerName.discussions.toString()));
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get container request returns status code 400 when container item doesn't exist")
|
||||
public void getContainerWithNonExistentItem() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(testUserModel)
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainer("NonExistentFolder");
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, publicSiteWithContainers.getId(), "NonExistentFolder"));
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get container request returns status 200 for public site")
|
||||
public void getContainerForPublicSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(testUserModel)
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainer(ContainerName.discussions.toString())
|
||||
.assertThat().field("folderId").is(ContainerName.discussions.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.authenticateUser(testUserModel)
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainer(ContainerName.links.toString())
|
||||
.assertThat().field("folderId").is(ContainerName.links.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get container request returns status 200 for private site")
|
||||
public void getContainerForPrivateSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(privateSiteModel).getSiteContainer(ContainerName.discussions.toString())
|
||||
.assertThat().field("folderId").is(ContainerName.discussions.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.withCoreAPI().usingSite(privateSiteModel).getSiteContainer(ContainerName.links.toString())
|
||||
.assertThat().field("folderId").is(ContainerName.links.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get container request returns status 200 for moderated site")
|
||||
public void getContainerForModeratedSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(moderatedSiteModel).getSiteContainer(ContainerName.discussions.toString())
|
||||
.assertThat().field("folderId").is(ContainerName.discussions.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.withCoreAPI().usingSite(moderatedSiteModel).getSiteContainer(ContainerName.links.toString())
|
||||
.assertThat().field("folderId").is(ContainerName.links.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class GetSiteContainersCoreTests extends RestTest
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 200 when valid skipCount parameter is used")
|
||||
public void getSitesWithValidSkipCount() throws Exception
|
||||
public void getSiteContainerWithValidSkipCount() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager)).withParams("skipCount=1")
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers()
|
||||
@@ -134,7 +134,7 @@ public class GetSiteContainersCoreTests extends RestTest
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 400 when invalid skipCount parameter is used")
|
||||
public void getSitesWithSkipCountCharacter() throws Exception
|
||||
public void getSiteContainerWithSkipCountCharacter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator)).withParams("skipCount=abc")
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers();
|
||||
@@ -144,7 +144,7 @@ public class GetSiteContainersCoreTests extends RestTest
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 200 when skipCount parameter starts with multiple zero")
|
||||
public void getSitesWithSkipCountMultipleZero() throws Exception
|
||||
public void getSiteContainerWithSkipCountMultipleZero() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator)).withParams("skipCount=00002")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
@@ -154,7 +154,7 @@ public class GetSiteContainersCoreTests extends RestTest
|
||||
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 400 when invalid skipCount parameter is used")
|
||||
description= "Verify if get site container request returns status code 400 when site doesn't exist")
|
||||
public void getSiteContainerWithNonExistentSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
|
||||
Reference in New Issue
Block a user