mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch 'master' of https://gitlab.alfresco.com/tas/alfresco-tas-restapi-test
# Conflicts: # src/main/java/org/alfresco/rest/core/assertion/ModelAssertion.java
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
package org.alfresco.rest.comments;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestCommentModel;
|
||||
import org.alfresco.rest.model.RestCommentModelsCollection;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
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.apache.commons.lang.RandomStringUtils;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Andrei Rusu
|
||||
*/
|
||||
public class AddCommentsFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
private String comment = "This is a new comment";
|
||||
private String comment2 = "This is the second comment";
|
||||
private RestCommentModelsCollection comments;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Using Manager user verify that you can provide a large string for one comment")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addLongCommentsWithManagerAndCheckThatCommentIsReturned() throws Exception
|
||||
{
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String longString = RandomStringUtils.randomAlphanumeric(10000);
|
||||
String longString1 = RandomStringUtils.randomAlphanumeric(90000);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(document).addComments(longString, longString1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", longString);
|
||||
comments.assertThat().entriesListContains("content", longString1);
|
||||
comments.assertThat().paginationField("totalItems").is("2");
|
||||
comments.assertThat().paginationField("count").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Using Manager user verify that you can provide a short string for one comment")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addShortCommentsWithManagerAndCheckThatCommentIsReturned() throws Exception
|
||||
{
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String shortString = RandomStringUtils.randomAlphanumeric(2);
|
||||
String shortString1 = RandomStringUtils.randomAlphanumeric(1);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(document).addComments(shortString, shortString1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", shortString);
|
||||
comments.assertThat().entriesListContains("content", shortString1);
|
||||
comments.assertThat().paginationField("totalItems").is("2");
|
||||
comments.assertThat().paginationField("count").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Using Collaborator user verify that you can provide a string with special characters for one comment")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addCommentsWithSpecialCharsWithCollaboratorCheckCommentIsReturned() throws Exception
|
||||
{
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String specialCharsString = "!@#$%^&*()_+♂µΓyádo«√<╡┌6£";
|
||||
String shortString = RandomStringUtils.randomAlphanumeric(2);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(document).addComments(specialCharsString, shortString);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", specialCharsString);
|
||||
comments.assertThat().entriesListContains("content", shortString);
|
||||
comments.assertThat().paginationField("totalItems").is("2");
|
||||
comments.assertThat().paginationField("count").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Using Manager user verify that you can not provide an empty string for one comment")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addEmptyStringCommentsWithManagerCheckCommentIsReturned() throws Exception
|
||||
{
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String emptyString = "";
|
||||
String spaceString = " ";
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(document).addComments(emptyString, spaceString);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(RestErrorModel.NON_NULL_COMMENT);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Using Collaborator user verify that you can provide several comments in one request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addSeveralCommentsWithCollaboratorCheckCommentsAreReturned() throws Exception
|
||||
{
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String charString = RandomStringUtils.randomAlphanumeric(10);
|
||||
String charString1 = RandomStringUtils.randomAlphanumeric(10);
|
||||
String charString2 = RandomStringUtils.randomAlphanumeric(10);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(document).addComments(comment, comment2, charString, charString1, charString2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", comment);
|
||||
comments.assertThat().paginationField("totalItems").is("5");
|
||||
comments.assertThat().paginationField("count").is("5");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Provide invalid request body parameter and check default error model schema")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void invalidRequestBodyParameterCheckErrorModelSchema() throws Exception
|
||||
{
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
String postBody = JsonBodyGenerator.keyValueJson("content2", comment);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/comments", document.getNodeRef());
|
||||
restClient.processModel(RestCommentModel.class, request);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().getErrorKey().contains("Unrecognized field \"content2\"");
|
||||
restClient.assertLastError().containsSummary("Unrecognized field \"content2\"");
|
||||
restClient.assertLastError().getDescriptionURL().contains("https://api-explorer.alfresco.com");
|
||||
restClient.assertLastError().getStackTrace().contains("For security reasons the stack trace is no longer displayed, but the property is kept for previous versions");
|
||||
}
|
||||
}
|
||||
@@ -115,10 +115,9 @@ public class AddCommentsSanityTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user gets status code 401 on post multiple comments call")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Bug(id="MNT-16904")
|
||||
public void unauthenticatedUserIsNotAbleToAddComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"))
|
||||
restClient.noAuthentication()
|
||||
.withCoreAPI().usingResource(document).addComments(comment1, comment2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
+153
-144
@@ -1,144 +1,153 @@
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
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;
|
||||
|
||||
public class DeleteFavoritesSanityTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel siteModel;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Admin user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void adminIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Manager user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void managerIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Collaborator user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void collaboratorIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteCollaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(siteCollaborator).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Contributor user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void contributorIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteContributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
restClient.authenticateUser(siteContributor).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Consumer user delets site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void consumerIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteConsumer = usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(siteConsumer).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user doesn't have permission to delete favorites of another user with Rest API and status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void userIsNotAbleToDeleteFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteCollaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(siteCollaborator).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI()
|
||||
.usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user doesn't have permission to delete favorites of admin user with Rest API and status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void userIsNotAbleToDeleteFavoritesOfAdminUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user doesn't have permission to delete favorites of another user with Rest API and status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void adminIsNotAbleToDeleteFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904", description = "fails only on environment with tenants")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user gets status code 401 if authentication call fails")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void userIsNotAbleToDeleteFavoritesIfAuthenticationFails() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser()
|
||||
.deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
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;
|
||||
|
||||
public class DeleteFavoriteSanityTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel siteModel;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
|
||||
siteModel.setGuid(restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Admin user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void adminIsAbleToDeleteFavorite() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user doesn't have permission to delete favorites of admin user with Rest API and status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void userIsNotAbleToDeleteFavoriteOfAdminUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user gets status code 401 if authentication call fails")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void managerIsNotAbleToDeleteFavoriteIfAuthenticationFails() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser()
|
||||
.deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Manager user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void managerIsAbleToDeleteFavorite() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Consumer user delets site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void consumerIsAbleToDeleteFavorite() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteConsumer = usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(siteConsumer).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Contributor user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void contributorIsAbleToDeleteFavorite() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteContributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
restClient.authenticateUser(siteContributor).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Collaborator user deletes site from favorites with Rest API and status code is 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void collaboratorIsAbleToDeleteFavorite() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteCollaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(siteCollaborator).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user doesn't have permission to delete favorites of another user with Rest API and status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void adminIsNotAbleToDeleteFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904", description = "fails only on environment with tenants")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user gets status code 401 if authentication call fails")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void userIsNotAbleToDeleteFavoritesIfAuthenticationFails() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser()
|
||||
.deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.withCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestActivityModelsCollection;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class GetPeopleActivitiesCoreTests extends RestTest
|
||||
{
|
||||
UserModel userModel, adminUser, managerUser;
|
||||
SiteModel siteModel1, siteModel2;
|
||||
FileModel fileInSite1, fileInSite2;
|
||||
FolderModel folderInSite2;
|
||||
private RestActivityModelsCollection restActivityModelsCollection;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel1 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
fileInSite1 = dataContent.usingUser(userModel).usingSite(siteModel1).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
siteModel2 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
folderInSite2 = dataContent.usingUser(userModel).usingSite(siteModel2).createFolder();
|
||||
fileInSite2 = dataContent.usingAdmin().usingSite(siteModel2).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
managerUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel2, UserRole.SiteManager);
|
||||
|
||||
// only once the activity list is checked with retry in order not to wait the entire list in each test
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getPersonActivitiesWithRetry();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("4");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user cannot get activities for inexistent user with Rest API and response is 404")
|
||||
public void userCannotGetPeopleActivitiesForInexistentPersonId() throws Exception
|
||||
{
|
||||
UserModel inexistentUserName = new UserModel("inexistent", "password");
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(inexistentUserName).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentUserName.getUsername()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets its activities for inexistent siteId with Rest API and response is 404")
|
||||
public void userGetItsPeopleActivitiesForInexistentSite() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).usingParams(String.format("siteId=inexistent")).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "inexistent"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities with invald skipCount parameter with Rest API and response is 400")
|
||||
public void userGetPeopleActivitiesUsingSkipCountParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("skipCount=-1").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT)
|
||||
.containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities with invalid maxItems parameter with Rest API and response is 400")
|
||||
public void userGetPeopleActivitiesUsingMaxItemsParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("maxItems=0").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities using invalid value for parameter 'who'with Rest API and response is 400")
|
||||
public void userGetsPeopleActivitiesUsingMeForWhoParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).usingParams("who=mee").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.INVALID_PARAMETER_WHO)
|
||||
.containsSummary(RestErrorModel.INVALID_PARAMETER_WHO)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities successfully using parameter 'who' with 'others' value with Rest API")
|
||||
public void userGetsPeopleActivitiesUsingOthersForWhoParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).usingParams("who=others").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("2");
|
||||
restActivityModelsCollection.assertThat().entriesListDoesNotContain("postPersonId", userModel.getUsername().toLowerCase())
|
||||
.and().entriesListContains("postPersonId", adminUser.getUsername().toLowerCase())
|
||||
.and().entriesListContains("postPersonId", managerUser.getUsername().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -97,13 +97,13 @@ public class GetPeopleActivitiesFullTests extends RestTest
|
||||
|
||||
@Bug(id = "ACE-5460")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user cannot get activities for empty user with Rest API and response is 404")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user cannot get activities for empty user with Rest API and response is 400")
|
||||
public void userCannotGetPeopleActivitiesForEmptyPersonId() throws Exception
|
||||
{
|
||||
UserModel emptyUserName = new UserModel("", "password");
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(emptyUserName).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.LOCAL_NAME_CONSISTANCE)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
@@ -111,7 +111,7 @@ public class GetPeopleActivitiesFullTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities successfully using parameter 'who' with 'me'vale with Rest API")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities successfully using parameter 'who' with 'me' value with Rest API")
|
||||
public void userGetsPeopleActivitiesUsingMeForWhoParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).usingParams("who=me").getPersonActivities();
|
||||
|
||||
@@ -37,6 +37,11 @@ public class GetPeopleActivitiesSanityTests extends RestTest
|
||||
UserRole.SiteContributor);
|
||||
unauthenticatedUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
unauthenticatedUser.setPassword("newpassword");
|
||||
|
||||
// only once the activity list is checked with retry in order not to wait the entire list in each test
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getPersonActivitiesWithRetry();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestPreferenceModel;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.PreferenceName;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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;
|
||||
|
||||
public class GetPeoplePreferenceFullTests extends RestTest
|
||||
{
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
private RestPreferenceModel restPreferenceModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
dataSite.usingUser(userModel).usingSite(siteModel).addSiteToFavorites();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check default error schema in case of failure")
|
||||
public void checkDefaultErrorSchema() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(new UserModel("invalidPersonID", "password"))
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidPersonID"))
|
||||
.statusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Specify -me- string in place of <personid> for request")
|
||||
public void preferenceIsReturnedWhenUsingMeAsPersonId() throws Exception
|
||||
{
|
||||
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingMe()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that properties parameter is applied")
|
||||
public void propertiesParameterIsAppliedWhenRetrievingPreference() throws Exception
|
||||
{
|
||||
restPreferenceModel = restClient.authenticateUser(userModel).withParams("properties=id").withCoreAPI().usingUser(userModel)
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").isNull();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(userModel).withParams("properties=id,value").withCoreAPI().usingUser(userModel)
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Validate ID element in get site preference response")
|
||||
public void validateIdElementInGetSitePreferenceResponse() throws Exception
|
||||
{
|
||||
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Validate ID element in get folder preference response")
|
||||
public void validateIdElementInGetFolderPreferenceResponse() throws Exception
|
||||
{
|
||||
FolderModel folderFavorite = new FolderModel("favoriteFolder");
|
||||
folderFavorite = dataContent.usingSite(siteModel).createFolder(folderFavorite);
|
||||
dataContent.getContentActions().setFolderAsFavorite(userModel.getUsername(), userModel.getPassword(), siteModel.getId(), folderFavorite.getName());
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.FOLDERS_FAVORITES_PREFIX)
|
||||
.and().field("value").is(Utility.removeLastSlash(Utility.buildPath("workspace://SpacesStore", folderFavorite.getNodeRef())));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Validate ID element in get file preference response")
|
||||
public void validateIdElementInGetFilePreferenceResponse() throws Exception
|
||||
{
|
||||
FileModel fileFavorite = new FileModel("favoriteFile", FileType.TEXT_PLAIN);
|
||||
fileFavorite = dataContent.usingSite(siteModel).createContent(fileFavorite);
|
||||
dataContent.getContentActions().setFileAsFavorite(userModel.getUsername(), userModel.getPassword(), siteModel.getId(), String.format("%s.%s", fileFavorite.getName(), fileFavorite.getFileType().extention));
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.DOCUMENTS_FAVORITES_PREFIX)
|
||||
.and().field("value").is(Utility.removeLastSlash(Utility.buildPath("workspace://SpacesStore", fileFavorite.getNodeRefWithoutVersion())));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get preference of an user that has no preferences")
|
||||
public void getPreferenceForUserWithoutPreferences() throws Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||
PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString()));
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX.toString());
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||
PreferenceName.SITES_FAVORITES_PREFIX.toString()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Change one preference for an user then perform get call")
|
||||
@Bug(id = "ACE-5736")
|
||||
public void changePreferenceThenPerformGetPreferenceCall() throws Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser();
|
||||
SiteModel site = dataSite.usingUser(newUser).createPublicRandomSite();
|
||||
|
||||
dataSite.usingUser(newUser).usingSite(site).addSiteToFavorites();
|
||||
|
||||
FileModel fileFavorite = new FileModel("favoriteFile", FileType.TEXT_PLAIN);
|
||||
fileFavorite = dataContent.usingSite(site).createContent(fileFavorite);
|
||||
dataContent.getContentActions().setFileAsFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), String.format("%s.%s", fileFavorite.getName(), fileFavorite.getFileType().extention));
|
||||
|
||||
FolderModel folderFavorite = new FolderModel("favoriteFolder");
|
||||
folderFavorite = dataContent.usingSite(site).createFolder(folderFavorite);
|
||||
dataContent.getContentActions().setFolderAsFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), folderFavorite.getName());
|
||||
|
||||
dataSite.usingUser(newUser).usingSite(site).removeSiteFromFavorites();
|
||||
dataContent.getContentActions().removeFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), folderFavorite.getName());
|
||||
dataContent.getContentActions().removeFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), Paths.get(fileFavorite.getCmisLocation()).getFileName().toString());
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX.toString());
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||
PreferenceName.SITES_FAVORITES_PREFIX.toString()));
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||
PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString()));
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to get preference of another user")
|
||||
public void adminIsAbleToGetOtherUserPreference() throws Exception
|
||||
{
|
||||
restPreferenceModel = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(userModel)
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user is not able to get preference of admin user")
|
||||
public void regularUserIsNotAbleToGetAdminPreference() throws Exception
|
||||
{
|
||||
SiteModel newSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
|
||||
dataSite.usingUser(dataUser.getAdminUser()).usingSite(newSite).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(dataUser.getAdminUser())
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + newSite.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestPreferenceModelsCollection;
|
||||
import org.alfresco.utility.constants.PreferenceName;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class GetPeoplePreferencesFullTests extends RestTest
|
||||
{
|
||||
UserModel userModel, user1, user2, adminUser;
|
||||
SiteModel siteModel;
|
||||
FolderModel folderModel;
|
||||
private RestPreferenceModelsCollection restPreferenceModelsCollection;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
folderModel = dataContent.usingUser(userModel).usingSite(siteModel).createFolder();
|
||||
|
||||
user1 = dataUser.createRandomTestUser();
|
||||
dataSite.usingUser(user1).usingSite(siteModel).addSiteToFavorites();
|
||||
dataContent.usingUser(user1).usingSite(siteModel).addFolderToFavorites(folderModel);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets its preferences using me with Rest API and response is successful")
|
||||
public void userGetsItsPeoplePreferencesUsingMe() throws Exception
|
||||
{
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingMe().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().paginationField("count").is("4");
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty()
|
||||
.and().entriesListContains("id", String.format(PreferenceName.EXT_FOLDERS_FAVORITES_PREFIX.toString(), "workspace://SpacesStore/" + folderModel.getNodeRef()))
|
||||
.and().entriesListContains("id", String.format(PreferenceName.EXT_SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||
.and().entriesListContains("id", PreferenceName.FOLDERS_FAVORITES_PREFIX.toString())
|
||||
.and().entriesListContains("value", "workspace://SpacesStore/" + folderModel.getNodeRef())
|
||||
.and().entriesListContains("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||
.and().entriesListContains("value", "true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets its preferences with skipCount parameter applied with Rest API and response is successful")
|
||||
public void userGetsItsPeoplePreferencesUsingSkipCountParameter() throws Exception
|
||||
{
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingMe().usingParams("skipCount=2").getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().paginationField("count").is("2");
|
||||
restPreferenceModelsCollection.assertThat().paginationField("skipCount").is("2");
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty()
|
||||
.and().entriesListDoesNotContain("id", String.format(PreferenceName.EXT_FOLDERS_FAVORITES_PREFIX.toString(), "workspace://SpacesStore/" + folderModel.getNodeRef()))
|
||||
.and().entriesListDoesNotContain("id", String.format(PreferenceName.EXT_SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||
.and().entriesListContains("id", PreferenceName.FOLDERS_FAVORITES_PREFIX.toString())
|
||||
.and().entriesListContains("value", "workspace://SpacesStore/" + folderModel.getNodeRef())
|
||||
.and().entriesListContains("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||
.and().entriesListContains("value", "true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets its preferences with maxItems parameter applied with Rest API and response is successful")
|
||||
public void userGetsItsPeoplePreferencesUsingMaxItemsParameter() throws Exception
|
||||
{
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingMe().usingParams("maxItems=1").getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().paginationField("count").is("1");
|
||||
restPreferenceModelsCollection.assertThat().paginationField("maxItems").is("1");
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty()
|
||||
.and().entriesListContains("id", String.format(PreferenceName.EXT_FOLDERS_FAVORITES_PREFIX.toString(), "workspace://SpacesStore/" + folderModel.getNodeRef()))
|
||||
.and().entriesListDoesNotContain("id", String.format(PreferenceName.EXT_SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||
.and().entriesListDoesNotContain("id", PreferenceName.FOLDERS_FAVORITES_PREFIX.toString())
|
||||
.and().entriesListDoesNotContain("value", "workspace://SpacesStore/" + folderModel.getNodeRef())
|
||||
.and().entriesListDoesNotContain("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||
.and().entriesListDoesNotContain("value", "true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets admin preferences with Rest API and response is permission denied")
|
||||
public void userIsForbiddenToGetAdminPreferences() throws Exception
|
||||
{
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingUser(adminUser).getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
restClient.assertLastError().containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets its preferences with skipCount parameter higher then no of entries with Rest API and response is empty")
|
||||
public void userGetsItsPeoplePreferencesUsingHighSkipCount() throws Exception
|
||||
{
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingMe().usingParams("skipCount=100").getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().paginationField("count").is("0");
|
||||
restPreferenceModelsCollection.assertThat().paginationField("skipCount").is("100");
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5460")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user cannot get preferences for empty user with Rest API and response is 400")
|
||||
public void userGetsItsPeoplePreferencesForEmptyPersonId() throws Exception
|
||||
{
|
||||
UserModel emptyUserName = new UserModel("", "password");
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingUser(emptyUserName).getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.LOCAL_NAME_CONSISTANCE)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user