mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
added core tests for getFavoriteSite
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.ErrorModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 11/22/2016.
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public class GetFavoriteSiteCoreTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel site1;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
site1 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
dataSite.usingUser(userModel).usingSite(site1).addSiteToFavorites();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when personId does not exist")
|
||||
public void getFavoriteSiteWithNonExistentPersonId() throws Exception
|
||||
{
|
||||
UserModel someUser = new UserModel("someUser", DataUser.PASSWORD);
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(someUser).getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, "someUser"));
|
||||
}
|
||||
|
||||
@Bug(id="MNT-17146")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when siteId does not exist")
|
||||
public void getFavoriteSiteWithNonExistentSiteId() throws Exception
|
||||
{
|
||||
SiteModel nonExistentSite = new SiteModel("nonExistentSite");
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getFavoriteSite(nonExistentSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(ErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), nonExistentSite.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User fails to get specific favorite site of admin with Rest API and response is 403")
|
||||
public void userFailsToGetFavoriteSiteOfAdmin() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(dataUser.getAdminUser()).getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user