mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch 'master' into master-getFavoriteSites
This commit is contained in:
@@ -147,7 +147,8 @@ public class AddCommentCoreTests extends RestTest
|
||||
|
||||
restClient.authenticateUser(member)
|
||||
.withCoreAPI().usingResource(document).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION,
|
||||
|
||||
@@ -106,7 +106,8 @@ public class AddCommentSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
restClient.withCoreAPI().usingResource(document).addComment("This is a new comment");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+2
-1
@@ -17,7 +17,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class DeleteCommentsCoreTests extends RestTest
|
||||
public class DeleteCommentCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
|
||||
@@ -38,6 +38,7 @@ public class DeleteCommentsCoreTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION, description = "Verify Consumer user can't delete comments created by admin user and status code is 403")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.CORE })
|
||||
public void consumerIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
@@ -0,0 +1,186 @@
|
||||
package org.alfresco.rest.comments;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
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.ListUserWithRoles;
|
||||
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.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 DeleteCommentFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel, networkUserModel;
|
||||
private SiteModel siteModel;
|
||||
private RestCommentModel commentModel;
|
||||
private RestCommentModelsCollection comments;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
private String comment = "This is a new comment";
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
networkUserModel = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,UserRole.SiteManager, UserRole.SiteConsumer,
|
||||
UserRole.SiteCollaborator, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify Manager user deletes comment created by admin"
|
||||
+ " and status code is 204. Check with getComments for validation")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void managerIsAbleToDeleteCommentCreatedByOthers() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListDoesNotContain("content", comment);
|
||||
comments.getPagination().assertThat().field("totalItems").is("0").and().field("count").is("0");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify Collaborator user can delete comment created by self"
|
||||
+ " and status code is 204. Check with getComments for validation")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void collaboratorIsAbleToDeleteCommentCreatedBySelf() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListDoesNotContain("content", comment);
|
||||
comments.getPagination().assertThat().field("totalItems").is("0").and().field("count").is("0");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify Contributor user deletes comment created by self"
|
||||
+ " and status code is 204. Check with getComments for validation")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
@Bug(id = "ACE-4614")
|
||||
public void contributorIsAbleToDeleteCommentCreatedBySelf() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListDoesNotContain("content", comment);
|
||||
comments.getPagination().assertThat().field("totalItems").is("0").and().field("count").is("0");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify Consumer user cannot delete comment created by admin"
|
||||
+ " and status code is 403. Check with getComments for validation and check default error model schema.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void consumerIsNotAbleToDeleteCommentCreatedByOthersDefaultErrorModelSchema() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.statusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", comment);
|
||||
comments.getPagination().assertThat().field("totalItems").is("1").and().field("count").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify Manager can delete comment with version number")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void usingManagerDeleteCommentWithVersionNumber() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
dataContent.usingAdmin().usingResource(file).updateContent("updated content to increase version number");
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify Manager user cannot delete comment with invalid node "
|
||||
+ "and status code is 404. Check with getComments for validation")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void usingManagerDeleteCommentWithInvalidNode() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(comment);
|
||||
file.setNodeRef("invalid");
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(file.getNodeRef() + " was not found");
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(file.getNodeRef() + " was not found");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleteComment from node with invalid network id returns status code 401")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void deleteCommentWithInvalidNetworkId() throws Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(comment);
|
||||
networkUserModel.setDomain("invalidNetwork");
|
||||
restClient.authenticateUser(networkUserModel).withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify deleteComment from node with empty network id returns status code 401")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void deleteCommentWithEmptyNetworkId() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(comment);
|
||||
networkUserModel.setDomain("");
|
||||
restClient.authenticateUser(networkUserModel).withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
+16
-2
@@ -4,6 +4,7 @@ import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestCommentModel;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
@@ -17,7 +18,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class DeleteCommentsSanityTests extends RestTest
|
||||
public class DeleteCommentSanityTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
|
||||
@@ -80,6 +81,18 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify Consumer user cannot delete comments and status code returned is 403")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void consumerIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
comment = restClient.withCoreAPI().usingResource(document).addComment("New comment added by Manager");
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
restClient.withCoreAPI().usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify User gets status code 401 if authentication call fails")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Bug(id="MNT-16904")
|
||||
@@ -90,6 +103,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
|
||||
restClient.authenticateUser(nonexistentModel);
|
||||
restClient.withCoreAPI().usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -112,8 +112,8 @@ public class GetCommentsCoreTests extends RestTest
|
||||
public void getCommentsWithInvalidNetwork() throws Exception
|
||||
{
|
||||
networkUserModel.setDomain("invalidNetwork");
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.authenticateUser(networkUserModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
@@ -122,8 +122,8 @@ public class GetCommentsCoreTests extends RestTest
|
||||
public void getCommentsWithEmptyNetwork() throws Exception
|
||||
{
|
||||
networkUserModel.setDomain("");
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.authenticateUser(networkUserModel).withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
package org.alfresco.rest.comments;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
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.exception.DataPreparationException;
|
||||
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.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.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetCommentsFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel siteModel;
|
||||
private String comment = "This is a new comment";
|
||||
private String comment2 = "This is the second comment";
|
||||
private RestCommentModelsCollection comments;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
private FileModel file;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator,
|
||||
UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun=true)
|
||||
public void setUp() throws DataPreparationException, Exception {
|
||||
file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify that if manager adds one comment, it will be returned in getComments response")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addCommentWithManagerAndCheckThatCommentIsReturned() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", comment)
|
||||
.getPagination().assertThat().field("totalItems").is("1")
|
||||
.assertThat().field("count").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify that if collaborator adds one comment, it will be returned in getComments response")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addCommentWithCollaboratorAndCheckThatCommentIsReturned() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", comment)
|
||||
.getPagination().assertThat().field("totalItems").is("1")
|
||||
.assertThat().field("count").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify that if contributor adds one comment, it will be returned in getComments response")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
@Bug(id = "ACE-4614")
|
||||
public void addCommentWithContributorAndCheckThatCommentIsReturned() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", comment)
|
||||
.getPagination().assertThat().field("totalItems").is("1")
|
||||
.assertThat().field("count").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify that consumer cannot add a comment and no comments will be returned in getComments response")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addCommentWithConsumerAndCheckThatCommentIsNotReturned() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().paginationField("totalItems").is("0");
|
||||
comments.assertThat().paginationField("count").is("0");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Add one comment with Manager and check that returned person is the right one")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addCommentWithManagerCheckReturnedPersonIsTheRightOne() throws Exception
|
||||
{
|
||||
UserModel user1 = dataUser.createRandomTestUser();
|
||||
dataUser.addUserToSite(user1, siteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(user1).withCoreAPI().usingResource(file).addComment(comment);
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
comments.getOneRandomEntry().onModel().getCreatedBy().assertThat().field("firstName").is(user1.getUsername() + " FirstName")
|
||||
.assertThat().field("lastName").is("LN-" + user1.getUsername());
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Add one comment with Collaborator and check that returned company details are correct")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addCommentWithCollaboratorCheckReturnedCompanyDetails() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
comments.getOneRandomEntry().onModel().getCreatedBy().getCompany()
|
||||
.assertThat().field("organization").isNull()
|
||||
.assertThat().field("address1").isNull()
|
||||
.assertThat().field("address2").isNull()
|
||||
.assertThat().field("address3").isNull()
|
||||
.assertThat().field("postcode").isNull()
|
||||
.assertThat().field("telephone").isNull()
|
||||
.assertThat().field("fax").isNull()
|
||||
.assertThat().field("email").isNull();
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Add 2 comments with Manager and Collaborator users and verify valid request using skipCount. Check that param is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addTwoCommentsWithManagerCollaboratorVerifySkipCountParamIsApplied() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(file).addComment(comment2);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withParams("skipCount=1")
|
||||
.withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", comment)
|
||||
.and().paginationField("count").is("1");
|
||||
comments.assertThat().paginationField("skipCount").is("1");
|
||||
comments.assertThat().paginationField("totalItems").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Add 2 comments with Admin and Collaborator users and verify valid request using maxItems. Check that param is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addTwoCommentsWithAdminCollaboratorVerifyMaxItemsParamIsApplied() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(file).addComment(comment2);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withParams("maxItems=1")
|
||||
.withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", comment2)
|
||||
.and().paginationField("count").is("1");
|
||||
comments.assertThat().paginationField("totalItems").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Add 2 comments with Manager and Admin users and verify valid request using properties. Check that param is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addTwoCommentsWithAdminManagerVerifyPropertiesParamIsApplied() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(comment);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingResource(file).addComment(comment2);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withParams("properties=createdBy,modifiedBy")
|
||||
.withCoreAPI().usingResource(file).getNodeComments();
|
||||
comments.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationField("count").is("2");
|
||||
comments.assertThat().paginationField("totalItems").is("2");
|
||||
|
||||
comments.getEntries().get(0).onModel().getCreatedBy()
|
||||
.assertThat().field("firstName").is(usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername() + " FirstName")
|
||||
.assertThat().field("lastName").is("LN-" + usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername());
|
||||
|
||||
comments.getEntries().get(1).onModel().getCreatedBy()
|
||||
.assertThat().field("firstName").is("Administrator")
|
||||
.assertThat().field("id").is("admin");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Check default error model schema")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void addTwoCommentsWithManagerCheckDefaultErrorModelSchema() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).addComments(comment, comment2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).usingParams("maxItems=0").getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
restClient.assertLastError().getErrorKey().contains("Only positive values supported for maxItems.");
|
||||
restClient.assertLastError().containsSummary("Only positive values supported for maxItems.");
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestCommentModelsCollection;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
@@ -40,7 +41,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Admin user gets comments with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
@@ -51,7 +52,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
comments.assertThat().entriesListContains("content", content);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Manager user gets comments created by admin user with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void managerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
@@ -62,7 +63,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
comments.assertThat().entriesListContains("content", content);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Contributor user gets comments created by admin user with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void contributorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
@@ -73,7 +74,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
comments.assertThat().entriesListContains("content", content);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Collaborator user gets comments created by admin user with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void collaboratorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
@@ -84,7 +85,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
comments.assertThat().entriesListContains("content", content);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Consumer user gets comments created by admin user with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void consumerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
@@ -95,8 +96,9 @@ public class GetCommentsSanityTests extends RestTest
|
||||
comments.assertThat().entriesListContains("content", content);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Manager user gets status code 401 if authentication call fails")
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Manager user gets status code 401 if authentication call fails")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Bug(id="MNT-16904")
|
||||
public void managerIsNotAbleToRetrieveCommentIfAuthenticationFails() throws JsonToModelConversionException, Exception
|
||||
@@ -104,10 +106,11 @@ public class GetCommentsSanityTests extends RestTest
|
||||
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
|
||||
restClient.authenticateUser(nonexistentModel).withCoreAPI()
|
||||
.usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify Manager user gets comments created by another user and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void managerIsAbleToRetrieveCommentsCreatedByAnotherUser() throws JsonToModelConversionException, Exception
|
||||
@@ -124,7 +127,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
.and().entriesListContains("content", content);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
|
||||
description= "Verify admin user gets comments created by another user and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void adminIsAbleToRetrieveCommentsCreatedByAnotherUser() throws JsonToModelConversionException, Exception
|
||||
|
||||
+8
-7
@@ -21,7 +21,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class UpdateCommentsCoreTests extends RestTest
|
||||
public class UpdateCommentCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private FileModel document;
|
||||
@@ -74,21 +74,22 @@ public class UpdateCommentsCoreTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION, description = "Verify updated comment by Manager is listed when calling getComments and status code is 200")
|
||||
@Bug(id="REPO-1011")
|
||||
// @Bug(id="REPO-1011")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.CORE })
|
||||
public void updatedCommentByManagerIsListed() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
commentModel = restClient.withCoreAPI().usingResource(document).addComment("This is a new comment added by collaborator");
|
||||
restClient.withCoreAPI().usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user");
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(document).addComment("This is a new comment added by collaborator");
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI()
|
||||
.usingResource(document).updateComment(commentModel, "This is the updated comment with Manager user");
|
||||
comments = restClient.withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", "This is the updated comment with Collaborator user");
|
||||
comments.assertThat().entriesListContains("content", "This is the updated comment with Manager user");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION, description = "Verify Collaborator user can not update comments of another user and status code is 200")
|
||||
@Bug(id="MNT-2502",description="seems it's one old issue: also logged as MNT-2502, MNT-2346")
|
||||
// @Bug(id="MNT-2502",description="seems it's one old issue: also logged as MNT-2502, MNT-2346")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.CORE })
|
||||
public void collaboratorIsNotAbleToUpdateCommentOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
@@ -0,0 +1,285 @@
|
||||
package org.alfresco.rest.comments;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
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.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class UpdateCommentFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel, networkUserModel;
|
||||
private SiteModel siteModel;
|
||||
private RestCommentModel commentModel, returnedCommentModel;
|
||||
private RestCommentModelsCollection comments;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
private String firstComment = "This is a new comment";
|
||||
private String updatedComment = "This is the updated comment";
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
networkUserModel = dataUser.createRandomTestUser();
|
||||
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}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify Manager user can update a comment with a large string")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void managerIsAbleToUpdateACommentWithALargeString() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String longString = RandomStringUtils.randomAlphanumeric(10000);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedCommentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).updateComment(commentModel, longString);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedCommentModel.assertThat().field("content").is(longString);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify Manager user can update a comment with a short string")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void managerIsAbleToUpdateACommentWithAShortString() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String shortString = RandomStringUtils.randomAlphanumeric(2);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedCommentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).updateComment(commentModel, shortString);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedCommentModel.assertThat().field("content").is(shortString);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify Collaborator user can update a comment with special characters")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void collaboratorIsAbleToUpdateACommentThatContainsSpecialChars() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String specialChars = "!@#$%^&*()'\".,<>-_+=|\\";
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedCommentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(file).updateComment(commentModel, specialChars);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedCommentModel.assertThat().field("content").is(specialChars);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Check that you cannot update comment with Consumer then call getComments and check new comment is not listed")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void cannotUpdateCommentWithConsumerCallGetComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", firstComment)
|
||||
.and().entriesListDoesNotContain("content", updatedComment)
|
||||
.and().paginationField("totalItems").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Update comment with Contributor then call getComments and check new comment is listed")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
@Bug(id = "ACE-4614")
|
||||
public void updateCommentWithContributorCallGetComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", updatedComment)
|
||||
.and().entriesListDoesNotContain("content", firstComment)
|
||||
.and().paginationField("totalItems").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Update comment with Collaborator then call getComments and check new comment is listed")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void updateCommentWithCollaboratorCallGetComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", updatedComment)
|
||||
.and().entriesListDoesNotContain("content", firstComment)
|
||||
.and().paginationField("totalItems").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Update comment with Manager then check modified by information in response")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void updateCommentWithManagerCheckModifiedBy() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
UserModel manager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedCommentModel = restClient.authenticateUser(manager).withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedCommentModel.assertThat().field("modifiedBy.id").is(manager.getUsername())
|
||||
.and().field("content").is(updatedComment);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Delete comment with Admin then try to update it")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void deleteCommentThenTryToUpdateIt() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.withCoreAPI().usingResource(file).deleteComment(commentModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify Manager user can update a comment with multi byte content")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void managerIsAbleToUpdateACommentWithMultiByteContent() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
String multiByte = "\ufeff\u6768\u6728\u91d1";
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedCommentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).updateComment(commentModel, multiByte);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedCommentModel.assertThat().field("content").is(multiByte);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify Admin user can update a comment with properties parameter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void adminIsAbleToUpdateACommentWithPropertiesParameter() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
UserModel manager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
|
||||
returnedCommentModel = restClient.authenticateUser(manager)
|
||||
.withParams("properties=createdBy,modifiedBy,canEdit,canDelete").withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedCommentModel.assertThat().field("createdBy.id").is(adminUserModel.getUsername())
|
||||
.assertThat().field("modifiedBy.id").is(manager.getUsername())
|
||||
.assertThat().fieldsCount().is(4);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FULL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Update comment with invalid node")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void updateCommentUsingInvalidNodeId() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
file.setNodeRef(RandomStringUtils.randomAlphanumeric(20));
|
||||
restClient.withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, file.getNodeRef()));
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify update comment from node with invalid network id returns status code 401")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void updateCommentWithInvalidNetworkId() throws Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
networkUserModel.setDomain("invalidNetwork");
|
||||
restClient.authenticateUser(networkUserModel).withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.FULL, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify User can not update comment to a not joined private site. Status code returned is 403")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.FULL })
|
||||
public void userCanNotUpdateCommentToANotJoinedPrivateSiteDefaultErrorModelSchema() throws Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser();
|
||||
FileModel file = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
|
||||
commentModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingResource(file).addComment(firstComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(newUser).withCoreAPI().usingResource(file).updateComment(commentModel, updatedComment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY);
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -19,7 +19,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class UpdateCommentsSanityTests extends RestTest
|
||||
public class UpdateCommentSanityTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private FileModel document;
|
||||
@@ -93,7 +93,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify Collaborator user can update his own comment and status code is 200")
|
||||
@Bug(id="REPO-1011")
|
||||
// @Bug(id="REPO-1011")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void collaboratorIsAbleToUpdateHisComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
@@ -114,7 +114,8 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
UserModel incorrectUserModel = new UserModel("userName", "password");
|
||||
restClient.authenticateUser(incorrectUserModel)
|
||||
.withCoreAPI().usingResource(document).updateComment(commentModel, "try to update");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SANITY }, executionType = ExecutionType.SANITY, description = "Verify update comment with inexistent nodeId returns status code 404")
|
||||
@@ -55,7 +55,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
SiteModel site = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
site.setGuid(link.getNodeRef());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(site);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(site);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, site.getGuid().split("/")[3]));
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE })
|
||||
public void addFavoriteUsingInexistentUser() throws Exception
|
||||
{
|
||||
restClient.withCoreAPI().usingUser(new UserModel("random_user", "random_password")).addSiteToFavorites(siteModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(new UserModel("random_user", "random_password")).addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "random_user"));
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
SiteModel site = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
site.setGuid("random_guid");
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(site);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(site);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "random_guid"));
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE })
|
||||
public void addFavoriteTwice() throws Exception
|
||||
{
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT);
|
||||
@@ -102,7 +102,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
String nodeRef = document.getNodeRef();
|
||||
document.setNodeRef(folder.getNodeRef());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().addFileToFavorites(document);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFileToFavorites(document);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
|
||||
adminUserModel.getUsername(), folder.getNodeRefWithoutVersion()));
|
||||
|
||||
@@ -129,7 +129,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListContains("guid", siteModel.getGuid());
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListContains("guid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -164,7 +164,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(siteModel.getGuid());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListContains("guid", siteModel.getGuid());
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListContains("guid", siteModel.getGuid());
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-17158")
|
||||
@@ -204,7 +204,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
String guid = siteModel.getGuid();
|
||||
siteModel.setGuid(document.getNodeRefWithoutVersion());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, document.getNodeRefWithoutVersion()));
|
||||
|
||||
siteModel.setGuid(guid);
|
||||
@@ -218,7 +218,7 @@ public class AddFavoritesCoreTests extends RestTest
|
||||
String nodeRef = folder.getNodeRef();
|
||||
folder.setNodeRef(document.getNodeRef());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().addFolderToFavorites(folder);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFolderToFavorites(folder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, document.getNodeRef()));
|
||||
|
||||
folder.setNodeRef(nodeRef);
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestFileModel;
|
||||
import org.alfresco.rest.model.RestFolderModel;
|
||||
import org.alfresco.rest.model.RestPersonFavoritesModel;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
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.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class AddFavoritesFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel siteModel;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
private RestPersonFavoritesModel restPersonFavoritesModel;
|
||||
|
||||
FileModel document;
|
||||
FolderModel folder;
|
||||
|
||||
@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);
|
||||
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
folder = dataContent.usingSite(siteModel).usingUser(adminUserModel).createFolder();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a file for a Collaborator, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void collaboratorIsAbleToAddFileToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingAuthUser().addFileToFavorites(document);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(document.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a file for a Contributor, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void contributorIsAbleToAddFileToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingAuthUser().addFileToFavorites(document);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(document.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a file for a Consumer, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void consumerIsAbleToAddFileToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingAuthUser().addFileToFavorites(document);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(document.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a folder for a Collaborator, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void collaboratorIsAbleToAddFolderToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).addFolderToFavorites(folder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(folder.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a folder for a Contributor, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void contributorIsAbleToAddFolderToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingAuthUser().addFolderToFavorites(folder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(folder.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a folder for a Consumer, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void consumerIsAbleToAddFolderToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).addFolderToFavorites(folder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(folder.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a site for a Collaborator, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void collaboratorIsAbleToAddSiteToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a site for a Contributor, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void contributorIsAbleToAddSiteToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add to favorites a site for a Consumer, check it was added")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void consumerIsAbleToAddSiteToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that if user provides file in target but guid is of a site status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void addSiteToFavoritesUsingFolderId() throws Exception
|
||||
{
|
||||
SiteModel newSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
newSiteModel.setGuid(folder.getNodeRef());
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(newSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, folder.getNodeRef()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that if user provides folder in target but guid is of a site status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void addFolderToFavoritesUsingSiteId() throws Exception
|
||||
{
|
||||
FolderModel newFolder = dataContent.usingSite(siteModel).usingUser(adminUserModel).createFolder();
|
||||
newFolder.setNodeRef(siteModel.getGuid());
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFolderToFavorites(newFolder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
|
||||
adminUserModel.getUsername(), siteModel.getGuid()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the response of favorite a site call is valid")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyFavoriteASiteResponseIsValid() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(siteModel.getGuid());
|
||||
|
||||
RestSiteModel restSiteModel = restPersonFavoritesModel.getTarget().getSite();
|
||||
restSiteModel.assertThat().field("visibility").is(siteModel.getVisibility()).and()
|
||||
.field("guid").is(siteModel.getGuid()).and()
|
||||
.field("description").is(siteModel.getDescription()).and()
|
||||
.field("id").is(siteModel.getId()).and()
|
||||
.field("title").is(siteModel.getTitle());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the response of favorite a file call is valid")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyFavoriteAFileResponseIsValid() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingAuthUser().addFileToFavorites(document);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(document.getNodeRefWithoutVersion());
|
||||
|
||||
RestFileModel restFileModel = restPersonFavoritesModel.getTarget().getFile();
|
||||
restFileModel.assertThat().field("mimeType").is("text/plain").and()
|
||||
.field("isFile").is("true").and()
|
||||
.field("isFolder").is("false").and()
|
||||
.field("createdBy").is(adminUserModel.getUsername());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the response of favorite a folder call is valid")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyFavoriteAFolderResponseIsValid() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingAuthUser().addFolderToFavorites(folder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(folder.getNodeRef());
|
||||
|
||||
RestFolderModel restFolderModel = restPersonFavoritesModel.getTarget().getFolder();
|
||||
restFolderModel.assertThat().field("isFile").is("false").and()
|
||||
.field("isFolder").is("true").and()
|
||||
.field("createdBy").is(adminUserModel.getUsername());
|
||||
}
|
||||
|
||||
@Bug(id = "REPO-1061")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that if user does not have permission to favorite a site status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyFavoriteASiteIfTheUserDoesNotHavePermission() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(adminUserModel).createPrivateRandomSite();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingAuthUser().addSiteToFavorites(privateSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, privateSite.getGuid()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.containsErrorKey(RestErrorModel.NOT_FOUND_ERRORKEY)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the post favorites request when network id is invalid for tenant user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL, TestGroup.NETWORKS})
|
||||
public void addFavoriteSitesWhenNetworkIdIsInvalid() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
|
||||
tenantUser.setDomain("invalidNetwork");
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the response of favorite a sie with empty body at request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyFavoriteASiteWithEmptyBody() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "", "people/{personId}/favorites", adminUserModel.getUsername());
|
||||
restClient.processModel(RestPersonFavoritesModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NO_CONTENT, "No content to map to Object due to end of input"));;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ 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.rest.model.RestPersonFavoritesModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
@@ -36,7 +37,7 @@ public class AddFavoritesSanityTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
public void adminIsAbleToAddToFavorites() throws Exception
|
||||
{
|
||||
restPersonFavoritesModel = restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restPersonFavoritesModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(siteModel.getGuid());
|
||||
}
|
||||
@@ -95,6 +96,7 @@ public class AddFavoritesSanityTests extends RestTest
|
||||
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
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.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.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 DeleteFavoriteCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel siteModel;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
private FileModel fileModel;
|
||||
private FolderModel folderModel;
|
||||
|
||||
@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());
|
||||
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
folderModel = dataContent.usingSite(siteModel).usingUser(adminUserModel).createFolder();
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that status code is 404 if PersonID is incorrect - favorite file.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE})
|
||||
public void deleteFavoriteIfPersonIdNotExists() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
restClient.withCoreAPI().usingAuthUser().addFileToFavorites(fileModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(new UserModel("inexistent", "inexistent"))
|
||||
.deleteFileFromFavorites(fileModel).assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "inexistent"));
|
||||
}
|
||||
|
||||
@Bug(id="ACE-2413")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that status code is 404 if PersonID is empty - favorite file.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE})
|
||||
public void deleteFavoriteIfPersonIdIsEmpty() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
restClient.withCoreAPI().usingAuthUser().addFileToFavorites(fileModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(new UserModel ("", ""))
|
||||
.deleteFileFromFavorites(fileModel).assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that status code is 404 if FavoriteID is incorrect - favorite file.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE})
|
||||
public void deleteFavoriteFileIfFavoriteIdIsIncorrect() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFileToFavorites(fileModel);
|
||||
|
||||
fileModel.setNodeRef("wrongFavoriteId");
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.deleteFileFromFavorites(fileModel).assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "wrongFavoriteId"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that status code is 404 if FavoriteID is incorrect - favorite file.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE})
|
||||
public void deleteFavoriteFileIfFavoriteIdNotExists() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFileToFavorites(fileModel);
|
||||
FileModel inexistentDocument = new FileModel();
|
||||
inexistentDocument.setNodeRef("inexistent");
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.deleteFileFromFavorites(inexistentDocument).assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "inexistent"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that status code is 404 if FavoriteID is incorrect - favorite site.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE})
|
||||
public void deleteFavoriteIfFavoriteIdNotExists() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
siteModel.setGuid("wrongFavoriteId");
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "wrongFavoriteId"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that status code is 404 if FavoriteID is incorrect - favorite folder.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE})
|
||||
public void deleteFavoriteFolderIfFavoriteIdNotExists() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
restClient.withCoreAPI().usingAuthUser().addFolderToFavorites(folderModel);
|
||||
|
||||
folderModel.setNodeRef("wrongFavoriteId");
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.deleteFolderFromFavorites(folderModel).assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "wrongFavoriteId"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)")
|
||||
public void deleteFavoriteSiteWithSuccessUsingMeAsPersonId() throws Exception
|
||||
{
|
||||
siteModel.setGuid(restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
restClient.withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingMe().deleteSiteFromFavorites(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Bug(id="ACE-5588")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
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.CORE })
|
||||
public void collaboratorIsNotAbleToDeleteFavoriteOfAnotherUser() 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="ACE-5588")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
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.CORE })
|
||||
public void adminIsNotAbleToDeleteFavoriteOfAnotherUser() 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
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.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.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 DeleteFavoriteFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel, tenantUser, adminTenantUser;
|
||||
private SiteModel siteModel;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
private FileModel fileModel;
|
||||
private FolderModel folderModel;
|
||||
|
||||
@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());
|
||||
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
folderModel = dataContent.usingSite(siteModel).usingUser(adminUserModel).createFolder();
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin deletes files from favorites with Rest API and status code is (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void adminIsAbleToDeleteFavoriteFile() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFileToFavorites(fileModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteFileFromFavorites(fileModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", fileModel.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin deletes folder from favorites with Rest API and status code is (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void adminIsAbleToDeleteFavoriteFolder() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFolderToFavorites(folderModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteFolderFromFavorites(folderModel)
|
||||
.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", fileModel.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@Bug(id="ACE-5588")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer 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.FULL })
|
||||
public void consumerIsNotAbleToDeleteFavoriteOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteConsumer = usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(siteConsumer).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI()
|
||||
.usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="ACE-5588")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor 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.FULL })
|
||||
public void contributorIsNotAbleToDeleteFavoriteOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteContributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
restClient.authenticateUser(siteContributor).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="ACE-5588")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor 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.FULL })
|
||||
public void adminIsNotAbleToDeleteFavoriteOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(user).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI()
|
||||
.usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is not able to deletes files from favorites that were already deleted with Rest API and status code is (404)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void adminIsNotAbleToDeletesADeletedFavoriteFile() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().addFileToFavorites(fileModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteFileFromFavorites(fileModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", fileModel.getNodeRefWithoutVersion());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().deleteFileFromFavorites(fileModel)
|
||||
.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
|
||||
adminUserModel.getUsername(), fileModel.getNodeRef()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can't delete favorites using an invalid network ID.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsNotAbleToDeleteFavoriteSiteWithInvalidNetworkID() throws Exception
|
||||
{
|
||||
UserModel networkUserModel = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(networkUserModel).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
networkUserModel.setDomain("invalidNetwork");
|
||||
|
||||
restClient.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED)
|
||||
.containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor 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.FULL })
|
||||
public void adminDeletesFavoriteForNotFavouriteFile() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser()
|
||||
.deleteFileFromFavorites(fileModel)
|
||||
.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
|
||||
adminUserModel.getUsername(), fileModel.getNodeRef()))
|
||||
.containsErrorKey(RestErrorModel.RELATIONSHIP_NOT_FOUND_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user is not able to delete favorites using an invalid network ID")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES,TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void tenantIsNotAbleToDeleteFavoriteSiteWithInvalidNetworkID() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
siteModel.setGuid(restClient.authenticateUser(tenantUser).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
tenantUser.setDomain("invalidNetwork");
|
||||
|
||||
restClient.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED)
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user deletes favorites site and status code is (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES,TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void tenantDeleteFavoriteSiteValidNetwork() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
siteModel.setGuid(restClient.authenticateUser(tenantUser).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
tenantUser.setDomain(tenantUser.getDomain());
|
||||
|
||||
restClient.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel.getGuidWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user deletes favorites site created by admin tenant - same network and status code is (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES,TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void tenantUserIsAbleToDeleteFavoriteSiteAddedByAdminSameNetwork() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
siteModel.setGuid(restClient.authenticateUser(adminTenantUser).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
|
||||
restClient.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteFromFavorites(siteModel)
|
||||
.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel.getGuidWithoutVersion());
|
||||
}
|
||||
|
||||
}
|
||||
+172
-144
@@ -1,144 +1,172 @@
|
||||
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 adminIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.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())
|
||||
.and().entriesListDoesNotContain("id", siteModel.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel.getTitle());
|
||||
}
|
||||
|
||||
@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())
|
||||
.and().entriesListDoesNotContain("id", siteModel.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel.getTitle());
|
||||
}
|
||||
|
||||
@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())
|
||||
.and().entriesListDoesNotContain("id", siteModel.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel.getTitle());
|
||||
}
|
||||
|
||||
@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())
|
||||
.and().entriesListDoesNotContain("id", siteModel.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel.getTitle());
|
||||
}
|
||||
|
||||
@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")
|
||||
@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).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ 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;
|
||||
@@ -57,6 +58,22 @@ public class GetFavoriteCoreTests extends RestTest {
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY);
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-2413")
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify get favorite site when person id is empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE })
|
||||
public void getFavoriteSiteWithEmptyUserId() throws JsonToModelConversionException, Exception {
|
||||
|
||||
restClient.withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
UserModel someUser = new UserModel("", DataUser.PASSWORD);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(someUser).getFavorite(siteModel.getGuid());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, someUser.getUsername()))
|
||||
.statusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify get favorite site when favorite id does't exist")
|
||||
@@ -100,4 +117,16 @@ public class GetFavoriteCoreTests extends RestTest {
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
favoriteSite.assertThat().field("targetGuid").equals(siteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify get favorite site for -me-")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE })
|
||||
public void getFavoriteFileUsingMe() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingAuthUser().addFileToFavorites(fileModel);
|
||||
|
||||
RestPersonFavoritesModel favoriteFile = restClient.withCoreAPI().usingMe().getFavorite(fileModel.getNodeRefWithoutVersion());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
favoriteFile.assertThat().field("targetGuid").equals(fileModel.getNodeRef());
|
||||
}
|
||||
}
|
||||
@@ -6,21 +6,22 @@ import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestPersonFavoritesModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
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.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.social.alfresco.api.entities.Site;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetFavoriteFullTests extends RestTest {
|
||||
private UserModel adminUserModel, networkUserModel;
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel siteModel;
|
||||
private FolderModel folderModel;
|
||||
private FileModel fileModel;
|
||||
@@ -29,7 +30,6 @@ public class GetFavoriteFullTests extends RestTest {
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception {
|
||||
|
||||
networkUserModel = dataUser.createRandomTestUser();
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
|
||||
@@ -43,22 +43,165 @@ public class GetFavoriteFullTests extends RestTest {
|
||||
UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify get favorite site when using invalid network id")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void getFavoriteSiteWhenNetworkIdIsInvalid() throws JsonToModelConversionException, Exception
|
||||
TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify the get favorite request for invalid network id")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void getFavoriteSiteWithInvalidNetworkId() throws Exception
|
||||
{
|
||||
networkUserModel.setDomain("invalidNetwork");
|
||||
restClient.withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
UserModel someUser = new UserModel("invalidUser", DataUser.PASSWORD);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(someUser).getFavorite(siteModel.getGuid());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, someUser.getUsername()))
|
||||
.statusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY);
|
||||
UserModel adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
tenantUser.setDomain("invalidNetwork");
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getFavorite(siteModel.getGuid());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify the get favorite request with tenant user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void getFavoriteSiteWithTenantUser() throws Exception
|
||||
{
|
||||
UserModel adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(adminTenantUser);
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorite(siteModel.getGuid());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Admin user gets favorite site with Rest API and validate details")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyRequestforGetFavoriteSite() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel);
|
||||
|
||||
RestPersonFavoritesModel favoriteSite = restClient.withCoreAPI().usingUser(adminUserModel).getFavorite(siteModel.getGuid());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
favoriteSite.assertThat().field("targetGuid").equals(siteModel.getGuid());
|
||||
favoriteSite.getTarget().getSite()
|
||||
.assertThat().field("guid").equals(siteModel.getGuid());
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Admin user gets favorite site with properties filter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyRequestforGetFavoriteSiteWithProperties() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel manager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
restClient.authenticateUser(manager);
|
||||
restClient.withCoreAPI().usingUser(manager).addSiteToFavorites(siteModel);
|
||||
|
||||
RestPersonFavoritesModel favoriteSite = restClient.authenticateUser(manager).withParams("properties=targetGuid")
|
||||
.withCoreAPI().usingAuthUser().getFavorite(siteModel.getGuid());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
favoriteSite.assertThat().field("targetGuid").equals(siteModel.getGuid());
|
||||
favoriteSite.assertThat().fieldsCount().is(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Admin user gets favorite site with inccorect properties filter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyRequestforGetFavoriteSiteWithInccorectProperties() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel collaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(collaborator);
|
||||
restClient.withCoreAPI().usingUser(collaborator).addFileToFavorites(fileModel);
|
||||
|
||||
RestPersonFavoritesModel favoriteFile = restClient.authenticateUser(collaborator).withParams("properties=tas")
|
||||
.withCoreAPI().usingAuthUser().getFavorite(fileModel.getNodeRefWithoutVersion());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
favoriteFile.assertThat().fieldsCount().is(0);
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify all values from get favorite rest api for a file")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyRequestFieldsforGetFavoriteFile() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel contributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
restClient.authenticateUser(contributor);
|
||||
restClient.withCoreAPI().usingUser(contributor).addFileToFavorites(fileModel);
|
||||
|
||||
RestPersonFavoritesModel favoriteFile = restClient.authenticateUser(contributor)
|
||||
.withCoreAPI().usingAuthUser().getFavorite(fileModel.getNodeRefWithoutVersion());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
favoriteFile.assertThat().field("targetGuid").is(fileModel.getNodeRefWithoutVersion())
|
||||
.and().field("target.file.isFile").is("true")
|
||||
.and().field("target.file.mimeType").is("text/plain")
|
||||
.and().field("target.file.isFolder").is("false")
|
||||
.and().field("target.file.createdBy").is(adminUserModel.getUsername())
|
||||
.and().field("target.file.versionLabel").is("1.0")
|
||||
.and().field("target.file.name").is(fileModel.getName())
|
||||
.and().field("target.file.parentId").is(folderModel.getNodeRef())
|
||||
.and().field("target.file.guid").is(fileModel.getNodeRefWithoutVersion())
|
||||
.and().field("target.file.modifiedBy").is(adminUserModel.getUsername())
|
||||
.and().field("target.file.id").is(fileModel.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify all values from get favorite rest api for a site")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyRequestFieldsforGetFavoriteSite() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel contributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
restClient.authenticateUser(contributor);
|
||||
restClient.withCoreAPI().usingUser(contributor).addFavoriteSite(siteModel);
|
||||
|
||||
RestPersonFavoritesModel favoriteSite = restClient.authenticateUser(contributor)
|
||||
.withCoreAPI().usingAuthUser().getFavorite(siteModel.getGuid());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
favoriteSite.assertThat().field("targetGuid").is(siteModel.getGuid())
|
||||
.and().field("target.site.role").is(UserRole.SiteContributor.toString())
|
||||
.and().field("target.site.visibility").is(Site.Visibility.PUBLIC.toString())
|
||||
.and().field("target.site.guid").is(siteModel.getGuid())
|
||||
.and().field("target.site.description").is(siteModel.getDescription())
|
||||
.and().field("target.site.id").is(siteModel.getId())
|
||||
.and().field("target.site.preset").is("site-dashboard")
|
||||
.and().field("target.site.title").is(siteModel.getTitle());
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify all values from get favorite rest api for a folder")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void verifyRequestFieldsforGetFavoriteFolder() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel contributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
restClient.authenticateUser(contributor);
|
||||
restClient.withCoreAPI().usingUser(contributor).addFolderToFavorites(folderModel);
|
||||
|
||||
RestPersonFavoritesModel favoriteFolder = restClient.authenticateUser(contributor)
|
||||
.withCoreAPI().usingAuthUser().getFavorite(folderModel.getNodeRef());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
favoriteFolder.assertThat().field("targetGuid").is(folderModel.getNodeRef())
|
||||
.and().field("target.folder.isFile").is("false")
|
||||
.and().field("target.folder.isFolder").is("true")
|
||||
.and().field("target.folder.createdBy").is(adminUserModel.getUsername())
|
||||
.and().field("target.folder.name").is(folderModel.getName())
|
||||
.and().field("target.folder.guid").is(folderModel.getNodeRef())
|
||||
.and().field("target.folder.modifiedBy").is(adminUserModel.getUsername())
|
||||
.and().field("target.folder.id").is(folderModel.getNodeRef());
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,6 @@ import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestPersonFavoritesModel;
|
||||
import org.alfresco.rest.model.RestPersonFavoritesModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
@@ -292,5 +290,4 @@ public class GetFavoriteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class GetFavoritesCoreTests extends RestTest
|
||||
.and().paginationField("totalItems").is("2");
|
||||
}
|
||||
|
||||
@Bug(id="REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
// @Bug(id="REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request using personId that does not exist returns status 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.CORE })
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
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.rest.model.RestPersonFavoritesModel;
|
||||
import org.alfresco.rest.model.RestPersonFavoritesModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
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 GetFavoritesFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private UserModel secondUserModel;
|
||||
private SiteModel firstSiteModel, secondSiteModel, thirdSiteModel;
|
||||
private RestPersonFavoritesModelsCollection userFavorites;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
secondUserModel = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
firstSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
secondSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
thirdSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
|
||||
firstSiteModel.setGuid(restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(firstSiteModel).getSite().getGuid());
|
||||
secondSiteModel.setGuid(restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(secondSiteModel).getSite().getGuid());
|
||||
thirdSiteModel.setGuid(restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(thirdSiteModel).getSite().getGuid());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteToFavorites(secondSiteModel);
|
||||
|
||||
restClient.authenticateUser(secondUserModel);
|
||||
restClient.withCoreAPI().usingUser(secondUserModel).addSiteToFavorites(firstSiteModel);
|
||||
restClient.withCoreAPI().usingUser(secondUserModel).addSiteToFavorites(secondSiteModel);
|
||||
restClient.withCoreAPI().usingUser(secondUserModel).addSiteToFavorites(thirdSiteModel);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites specifying -me- string in place of <personid> for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsAbleToGetFavoritesWhenUsingMeAsUsername() throws Exception
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(secondUserModel).withCoreAPI().usingMe().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
userFavorites.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid()).and().entriesListContains("targetGuid", secondSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites using empty for where parameter for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsAbleToGetFavoritesWhenUsingEmptyWhereParameter() throws Exception
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().where().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that for invalid maxItems parameter status code returned is 400.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void checkInvalidMaxItemsStatusCode() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withParams("maxItems=AB").withCoreAPI().usingUser(adminUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that for invalid skipCount parameter status code returned is 400.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void checkInvalidSkipCountStatusCode() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withParams("skipCount=AB").withCoreAPI().usingUser(adminUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites when using invalid network id for non-tenant user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void getFavoritesWhenNetworkIdIsInvalid() throws Exception
|
||||
{
|
||||
UserModel networkUserModel = dataUser.createRandomTestUser();
|
||||
networkUserModel.setDomain("invalidNetwork");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(networkUserModel).where().targetSiteExist().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, networkUserModel.getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites using special chars in where parameter for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsNotAbleToGetFavoritesWhenUsingSpecialCharsInWhereParameter() throws Exception
|
||||
{
|
||||
userFavorites = restClient.withCoreAPI().usingAuthUser().where().invalidWhereParameter("~!%40%23%24%25%5E%26*()_%2B%5B%5D%7B%7D%7C%5C%3B%27%3A%22%2C.%2F%3C%3E").getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"))
|
||||
.containsErrorKey(RestErrorModel.INVALID_QUERY_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites using AND instead of OR in where parameter for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsNotAbleToGetFavoritesWhenUsingANDInWhereParameter() throws Exception
|
||||
{
|
||||
userFavorites = restClient.withCoreAPI().usingAuthUser().where().targetFolderExist().invalidWhereParameter("AND").targetFileExist().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites using wrong name instead of EXISTS in where parameter for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsNotAbleToGetFavoritesWhenUsingWrongWhereParameter() throws Exception
|
||||
{
|
||||
userFavorites = restClient.withCoreAPI().usingAuthUser().where().invalidWhereParameter("EXIST((target/site))").targetFileExist().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites except the first one for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsAbleToGetFavoritesExceptTheFirstOne() throws Exception
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(secondUserModel).withParams("skipCount=1").withCoreAPI().usingUser(secondUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
userFavorites.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
|
||||
.and().entriesListContains("targetGuid", secondSiteModel.getGuid())
|
||||
.and().entriesListDoesNotContain("targetGuid", thirdSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get first two favorites sites")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsAbleToGetFirstTwoFavorites() throws Exception
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(secondUserModel).withParams("maxItems=2").withCoreAPI().usingUser(secondUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
userFavorites.assertThat().entriesListContains("targetGuid", thirdSiteModel.getGuid())
|
||||
.and().entriesListContains("targetGuid", secondSiteModel.getGuid())
|
||||
.and().entriesListDoesNotContain("targetGuid", firstSiteModel.getGuid())
|
||||
.getPagination().assertThat().field("maxItems").is("2")
|
||||
.and().field("hasMoreItems").is("true")
|
||||
.and().field("count").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites sites when using empty values for skipCount and maxItems")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsAbleToGetFavoritesWhenSkipCountAndMaxItemsAreEmpty() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(secondUserModel).withParams("skipCount= ").withCoreAPI().usingUser(secondUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, " "));
|
||||
|
||||
restClient.authenticateUser(secondUserModel).withParams("maxItems= ").withCoreAPI().usingUser(secondUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, " "));
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the get favorites request when network id is invalid for tenant user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL, TestGroup.NETWORKS})
|
||||
public void getFavoriteSitesWhenNetworkIdIsInvalid() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(firstSiteModel);
|
||||
|
||||
tenantUser.setDomain("invalidNetwork");
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the get favorites request for a high value for skipCount parameter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsAbleToGetFavoritesWithHighSkipCount() throws Exception
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(secondUserModel).withParams("skipCount=999999999").withCoreAPI().usingUser(secondUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
userFavorites.assertThat().entriesListIsEmpty().assertThat().paginationField("skipCount").is("999999999");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the get favorites request with properties parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
public void userIsAbleToGetFavoritesWithPropertiesParamApplied() throws Exception
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(secondUserModel).withParams("properties=targetGuid").withCoreAPI().usingUser(secondUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
RestPersonFavoritesModel restPersonFavoritesModel = userFavorites.getEntries().get(0).onModel();
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(thirdSiteModel.getGuid()).and().field("createdAt").isNull();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify entry details for get favorites response with Rest API")
|
||||
public void checkResponseSchemaForGetFavorites() throws Exception
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(secondUserModel).withCoreAPI().usingAuthUser().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
RestPersonFavoritesModel restPersonFavoritesModel = userFavorites.getEntries().get(0).onModel();
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(thirdSiteModel.getGuid());
|
||||
|
||||
RestSiteModel restSiteModel = restPersonFavoritesModel.getTarget().getSite();
|
||||
restSiteModel.assertThat().field("visibility").is(thirdSiteModel.getVisibility()).and()
|
||||
.field("guid").is(thirdSiteModel.getGuid()).and()
|
||||
.field("description").is(thirdSiteModel.getDescription()).and()
|
||||
.field("id").is(thirdSiteModel.getId()).and()
|
||||
.field("title").is(thirdSiteModel.getTitle());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
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 RestGetNetworkCoreTests extends RestTest
|
||||
{
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
UserModel adminuser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminuser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets non existing network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(UserModel.getRandomTenantUser());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Tests for /people/{personId}/networks
|
||||
*/
|
||||
public class RestGetNetworkForPersonCoreTests extends RestTest
|
||||
{
|
||||
UserModel adminUser;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
UserModel randomTestUser;
|
||||
RestNetworkModel restNetworkModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
randomTestUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("randomTestUser");
|
||||
}
|
||||
|
||||
@Bug(id = "needs to be checked")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request status code is 200 if a user tries to get network information of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyGetNetworkByAUserForAnotherUser() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(randomTestUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("id").is(tenantUser.getDomain());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that getNetwork status code is 404 for a personId that does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyThatGetNetworkStatusIs404ForAPersonIdThatDoesNotExist() throws Exception
|
||||
{
|
||||
UserModel invalidUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("validUsername");
|
||||
invalidUser.setUsername("invalidUsername");
|
||||
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(invalidUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, invalidUser.getUsername()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that getNetwork status code is 404 for a networkId that does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyThatGetNetworkStatusIs404ForANetworkIdThatDoesNotExist() throws Exception
|
||||
{
|
||||
UserModel invalidUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("invalidNetworkId");
|
||||
invalidUser.setDomain("invalidNetworkId");
|
||||
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(invalidUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, invalidUser.getUsername()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request that is made using -me- instead of personId")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyGetNetworkRequestUsingMeInsteadOfPersonId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
import org.alfresco.rest.model.RestNetworkQuotaModel;
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Tests for /people/{personId}/networks
|
||||
*/
|
||||
public class RestGetNetworkForPersonFullTests extends RestTest
|
||||
{
|
||||
UserModel adminUser;
|
||||
UserModel adminTenantUser;
|
||||
UserModel secondAdminTenantUser;
|
||||
UserModel tenantUser;
|
||||
RestNetworkModel restNetworkModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenantUser);
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request response entry details")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void verifyGetNetworkRequestResponseEntryDetails() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("quotas").is(new ArrayList<RestNetworkQuotaModel>())
|
||||
.assertThat().field("isEnabled").is("true")
|
||||
.assertThat().field("homeNetwork").is("true")
|
||||
.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that properties parameter is applied to getNetwork request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void verifyPropertiesParameterIsAppliedToGetNetworkRequest() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(adminTenantUser).withParams("properties=id").withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
// TODO add assert that entry has only 1 field
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request status code is 404 for a network to which user does not belong")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void verifyGetNetworkRequestStatusCodeIs404ForANetworkToWhichTheUserDoesNotBelong() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetwork(secondAdminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
@@ -10,11 +12,19 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests for /people/{personId}/networks
|
||||
*/
|
||||
public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
UserModel tenantSiteManager;
|
||||
UserModel tenantSiteCollaborator;
|
||||
UserModel tenantSiteContributor;
|
||||
UserModel tenantSiteConsumer;
|
||||
SiteModel tenantSite;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -24,51 +34,92 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
tenantSiteManager = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteManager");
|
||||
tenantSiteCollaborator = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteCollaborator");
|
||||
tenantSiteContributor = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteContributor");
|
||||
tenantSiteConsumer = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteConsumer");
|
||||
tenantSite = dataSite.usingUser(tenantSiteManager).createPublicRandomSite();
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteCollaborator, tenantSite, UserRole.SiteCollaborator);
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteContributor, tenantSite, UserRole.SiteContributor);
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteConsumer, tenantSite, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify non existing user gets another exisiting network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
description = "Verify non existing user gets another existing network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||
{
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS,TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingUser(adminTenantUser).getNetwork();
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(adminTenantUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Bug(id = "needs to be checked")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant user check network of admin user with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant user is not authorized to check network of admin user with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin tenant user is not authorized to check network of another user with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetwork(secondTenantUser);
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetwork(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteManagerChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteManager).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site collaborator user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteCollaboratorChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteCollaborator).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site contributor user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteContributorChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteContributor).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site consumer user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteConsumerChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteConsumer).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
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.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class RestGetNetworkFullTests extends RestTest
|
||||
{
|
||||
UserModel adminTenantUser, adminuser;
|
||||
UserModel adminAnotherTenantUser;
|
||||
SiteModel site;
|
||||
UserModel tenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminuser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminuser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
|
||||
adminAnotherTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(adminAnotherTenantUser);
|
||||
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("userTenant1");
|
||||
site = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5738")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets an invalid network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void adminTenantGetsInvalidNetwork() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminAnotherTenantUser);
|
||||
adminAnotherTenantUser.setDomain("tenant.@%");
|
||||
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminAnotherTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.UNEXPECTED_TENANT, adminTenantUser.getDomain(), "@"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5745")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user gets an existing network successfully with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void adminUserGetsExistingNetwork() throws Exception
|
||||
{
|
||||
RestNetworkModel restNetworkModel = restClient.authenticateUser(adminuser).withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().fieldsCount().is("1");
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain())
|
||||
.and().field("homeNetwork").isNull()
|
||||
.and().field("isEnabled").is("true");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets network using properties parameter successfully with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void adminTenantGetsNetworkUsingPropertiesParameter() throws Exception
|
||||
{
|
||||
JSONObject entryResponse= restClient.authenticateUser(tenantUser).withCoreAPI().usingNetworks().usingParams("properties=id").getNetworkWithParams(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
Assert.assertTrue(entryResponse.get("id").equals(adminTenantUser.getDomain().toLowerCase()));
|
||||
assertJsonResponseDoesnotContainField(entryResponse, "homeNetwork");
|
||||
assertJsonResponseDoesnotContainField(entryResponse, "isEnabled");
|
||||
}
|
||||
|
||||
private void assertJsonResponseDoesnotContainField(JSONObject entryResponse, String field)
|
||||
{
|
||||
try{
|
||||
entryResponse.get(field);
|
||||
}
|
||||
catch(JSONException ex)
|
||||
{
|
||||
Assert.assertTrue(ex.getMessage().equals(String.format("JSONObject[\"%s\"] not found.", field)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify non existing user gets another exisiting network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY})
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY})
|
||||
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||
{
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
@@ -51,7 +51,7 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
@@ -68,16 +68,6 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork().assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets non existing network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(UserModel.getRandomTenantUser());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets another existing network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@@ -119,7 +109,7 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify any tenant user gets another existing network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void userTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
@@ -129,7 +119,7 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void tenantManagerUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("manTenant");
|
||||
@@ -142,7 +132,7 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void tenantCollaboratorUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel collaboratorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("colTenant");
|
||||
@@ -155,7 +145,7 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void tenantConsumerUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel consumerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("consTenant");
|
||||
@@ -168,7 +158,7 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void tenantContributorUserChecksIfItsNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel contributorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("contTenant");
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModelsCollection;
|
||||
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;
|
||||
|
||||
public class RestGetNetworksForPersonCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using invalid value for skipCount")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void invalidValueForSkipCountTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withParams("skipCount=abc").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using invalid value for maxItems")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void invalidValueForMaxItemsTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withParams("maxItems=abc").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using personId that does not exist")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void inexistentTenantTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(new UserModel("invalidTenantUser", "password")).getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidTenantUser"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using -me- instead of personId")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void specifyMeInsteadOfPersonIdTest() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks and validate network entry")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void checkNetworkEntryTest() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled()
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase())
|
||||
.and().field("quotas").is("[]")
|
||||
.and().field("homeNetwork").is("false");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModelsCollection;
|
||||
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;
|
||||
|
||||
public class RestGetNetworksForPersonFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private UserModel adminTenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check default error schema for get networks for member")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void getNetworksAndCheckErrorSchema() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(new UserModel("invalidUser", "invalidPassword")).getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidUser"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check default error schema for get networks for member")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void getNetworksAndCheckPropertiesParameter() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("properties=isEnabled,id").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertThat().field("homeNetwork").is("false")
|
||||
.and().field("quotas").isNull()
|
||||
.and().field("isEnabled").is("true")
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that skipCount parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void checkThatSkipCountParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("skipCount=1").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that high skipCount parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void checkThatHighSkipCountParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("skipCount=100").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.assertThat().entriesListIsEmpty();
|
||||
networks.assertThat().paginationField("skipCount").is("100");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that maxItems parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void checkThatMaxItemsParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("maxItems=1").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertThat().field("homeNetwork").is("false")
|
||||
.and().field("quotas").is("[]")
|
||||
.and().field("isEnabled").is("true")
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
networks.assertThat().paginationField("maxItems").is("1");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
@@ -13,8 +17,9 @@ import org.testng.annotations.Test;
|
||||
public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
private UserModel adminTenantUser;
|
||||
private UserModel tenantUser;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -24,24 +29,26 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify non existing user gets another exisiting network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY, TestGroup.COMMENTS, TestGroup.NETWORKS })
|
||||
description = "Verify non existing user gets another exisiting network with Rest API and checks the unauthorized status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||
{
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY, TestGroup.COMMENTS, TestGroup.NETWORKS })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
@@ -51,7 +58,7 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant user is not authorized to check network of admin user with Rest API and checks the forbidden status")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY, TestGroup.COMMENTS, TestGroup.NETWORKS })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
@@ -61,7 +68,7 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin tenant user is not authorized to check network of another user with Rest API and checks the forbidden status")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY, TestGroup.COMMENTS, TestGroup.NETWORKS })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
@@ -71,4 +78,60 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant manager user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void managerTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("managerTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(managerTenantUser, siteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(managerTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(managerTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant collaborator user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void collaboratorTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel collaboratorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("collaboratorTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(collaboratorTenantUser, siteModel, UserRole.SiteCollaborator);
|
||||
|
||||
restClient.authenticateUser(collaboratorTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(collaboratorTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant contributor user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void contributorTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel contributorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("contributorTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(contributorTenantUser, siteModel, UserRole.SiteContributor);
|
||||
|
||||
restClient.authenticateUser(contributorTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(contributorTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant consumer user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void consumerTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel consumerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("consumerTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(consumerTenantUser, siteModel, UserRole.SiteConsumer);
|
||||
|
||||
restClient.authenticateUser(consumerTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(consumerTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestFavoriteSiteModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
@@ -100,6 +101,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
|
||||
managerUser.setPassword("newpassword");
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().addFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,15 @@ public class AddSiteMembershipRequestFullTests extends RestTest
|
||||
siteMembershipRequest = restClient.authenticateUser(regularUser).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
siteMembershipRequest.assertThat().field("id").is(moderatedSite.getId())
|
||||
.assertThat().field("message").is("Please accept me")
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
siteMembershipRequest.getSite()
|
||||
.assertThat().field("visibility").is(moderatedSite.getVisibility())
|
||||
.assertThat().field("guid").is(moderatedSite.getGuid())
|
||||
.assertThat().field("description").is(moderatedSite.getDescription())
|
||||
.assertThat().field("id").is(moderatedSite.getId())
|
||||
.assertThat().field("title").is(moderatedSite.getTitle());
|
||||
|
||||
siteMembershipRequests = restClient.withCoreAPI().usingAuthUser().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListContains("id", moderatedSite.getId())
|
||||
@@ -267,6 +275,23 @@ public class AddSiteMembershipRequestFullTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, adminTenantUser.getUsername().toLowerCase(), publicSite.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify create site membership request returns status code 200 with tenant.")
|
||||
public void addSiteMembershipRequestWithTenant() throws Exception
|
||||
{
|
||||
UserModel adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser)
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
|
||||
SiteModel tenantPublicSite = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
siteMembershipRequest = restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteMembershipRequest(tenantPublicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
siteMembershipRequest.assertThat().field("id").is(tenantPublicSite.getId())
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site membership request is automatically rejected when a site is switched from moderated to private")
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteMembershipRequestModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.alfresco.utility.constants.UserRole;
|
||||
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;
|
||||
@@ -30,7 +29,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)")
|
||||
public void removeFavoriteSiteWithSuccessUsingMeAsPersonId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
@@ -41,86 +41,118 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@Bug(id = "REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify inexistent user is not able to remove a site from favorites and response is 404")
|
||||
// @Bug(id = "REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent user is not able to remove a site from favorites and response is 404")
|
||||
public void inexistentUserIsNotAbleToRemoveFavoriteSite() throws Exception
|
||||
{
|
||||
UserModel inexistentUser = new UserModel("inexistenUser", "password");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(inexistentUser).removeFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "inexistenUser"));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(inexistentUser)
|
||||
.removeFavoriteSite(siteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "inexistenUser"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404")
|
||||
public void userIsNotAbleToRemoveFavoriteSiteWithInexistentId() throws Exception
|
||||
{
|
||||
SiteModel inexistentSite = new SiteModel("inexistentSite");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).removeFavoriteSite(inexistentSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, adminUserModel.getUsername(), inexistentSite.getTitle()));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel)
|
||||
.removeFavoriteSite(inexistentSite);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
|
||||
adminUserModel.getUsername(), inexistentSite.getTitle()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.RELATIONSHIP_NOT_FOUND_ERRORKEY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify manager user removes a site from its favorites and adds it again and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager user removes a site from its favorites and adds it again and response is successful (204)")
|
||||
public void managerUserRemovesFavoriteSiteAndAddItAgain() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel);
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser()
|
||||
.removeFavoriteSite(siteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingUser(managerUser).addFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void managerUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel);
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser()
|
||||
.removeFavoriteSite(siteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("id", siteModel.getId());
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat().entriesListDoesNotContain("id", siteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify uninvited user can delete favorite public site and response is 204")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify uninvited user can delete favorite public site and response is 204")
|
||||
public void uninvitedUserCanDeleteFavoritePublicSite() throws Exception
|
||||
{
|
||||
SiteModel publicSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).addFavoriteSite(publicSiteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(publicSiteModel);
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.removeFavoriteSite(publicSiteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", publicSiteModel.getId());
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites()
|
||||
.assertThat().entriesListDoesNotContain("id", publicSiteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify uninvited user can delete favorite moderated site and response is 204")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify uninvited user can delete favorite moderated site and response is 204")
|
||||
public void uninvitedUserCanDeleteFavoriteModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSiteModel = dataSite.usingUser(adminUserModel).createModeratedRandomSite();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).addFavoriteSite(moderatedSiteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(moderatedSiteModel);
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.removeFavoriteSite(moderatedSiteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", moderatedSiteModel.getId());
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites()
|
||||
.assertThat().entriesListDoesNotContain("id", moderatedSiteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user can delete favorite private site and response is 204")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can delete favorite private site and response is 204")
|
||||
public void userCanDeleteFavoritePrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSiteModel = dataSite.usingUser(userModel).createPrivateRandomSite();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).addFavoriteSite(privateSiteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(privateSiteModel);
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.removeFavoriteSite(privateSiteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", privateSiteModel.getId());
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites()
|
||||
.assertThat().entriesListDoesNotContain("id", privateSiteModel.getId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
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 DeleteFavoriteSiteFullTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel siteModel, siteModel1;
|
||||
UserModel adminUserModel, adminTenantUser, tenantUser;
|
||||
RestSiteModel restSiteModel;
|
||||
ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "User is not able to remove a favorite site of admin user")
|
||||
public void userIsNotAbleToDeleteFavoritesOfAdmin() throws Exception
|
||||
{
|
||||
UserModel contributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
dataSite.usingUser(contributor).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(contributor)
|
||||
.withCoreAPI().usingUser(adminUserModel).removeFavoriteSite(siteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Users removed twice from favorites same site.")
|
||||
public void managerUserRemovesDeletedFavoriteSite() throws Exception
|
||||
{
|
||||
UserModel managerUser = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel);
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_FAVOURITE_SITE, siteModel.getTitle()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Users removes from favorite a site that is already deleted.")
|
||||
public void consumerUserRemovesDeletedFavoriteSite() throws Exception
|
||||
{
|
||||
siteModel1 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel1, UserRole.SiteConsumer);
|
||||
dataSite.usingUser(consumerUser).usingSite(siteModel1).addSiteToFavorites();
|
||||
|
||||
dataSite.usingAdmin().deleteSite(siteModel1);
|
||||
restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
|
||||
consumerUser.getUsername(), siteModel1.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete favorite site that is NOT favorite.")
|
||||
public void adminUserRemovesDeletedFavoriteSiteThatIsNotFavorite() throws Exception
|
||||
{
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_FAVOURITE_SITE, siteModel.getTitle()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user doesn't have permission to delete favorites of another user with Rest API and status code is 403")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
public void userIsNotAbleToDeleteFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel siteCollaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
dataSite.usingUser(siteCollaborator).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI()
|
||||
.usingUser(siteCollaborator)
|
||||
.removeFavoriteSite(siteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user is not able to delete favorites using an invalid network ID")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void tenantIsNotAbleToDeleteFavoriteSiteWithInvalidNetworkID() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
siteModel.setGuid(restClient.authenticateUser(tenantUser).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
tenantUser.setDomain("invalidNetwork");
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED)
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user deletes favorites site and status code is (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void tenantDeleteFavoriteSiteValidNetwork() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
siteModel.setGuid(restClient.authenticateUser(tenantUser).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
tenantUser.setDomain(tenantUser.getDomain());
|
||||
|
||||
restClient.withCoreAPI()
|
||||
.usingAuthUser().removeFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel.getGuidWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user deletes favorites site created by admin tenant - same network and status code is (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void tenantUserIsAbleToDeleteFavoriteSiteAddedByAdminSameNetwork() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
siteModel.setGuid(restClient.authenticateUser(adminTenantUser).withCoreAPI().usingSite(siteModel).getSite().getGuid());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel.getGuidWithoutVersion());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +33,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void managerUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -43,10 +44,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
|
||||
.and().entriesListDoesNotContain("id", siteModel1.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void collaboratorUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -56,10 +66,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
|
||||
restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
|
||||
.and().entriesListDoesNotContain("id", siteModel1.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void contributorUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -69,10 +88,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
|
||||
restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
|
||||
.and().entriesListDoesNotContain("id", siteModel1.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void consumerUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -82,10 +110,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
|
||||
restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
|
||||
.and().entriesListDoesNotContain("id", siteModel1.getId())
|
||||
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
|
||||
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
|
||||
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user removes a site from any user's favorite sites list with Rest API and response is successful (204)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user removes a site from any user's favorite sites list with Rest API and response is successful (204)")
|
||||
public void adminUserRemovesAnyFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
@@ -98,8 +135,9 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify a user removes a site from another user's favorite sites list with Rest API and response is permission denied (403)")
|
||||
public void userUserRemovesAnotherUserFavoriteSiteWithSuccess() throws Exception
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify a user removes a site from another user's favorite sites list with Rest API and response is permission denied (403)")
|
||||
public void userRemovesAnotherUserFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel userAuth = dataUser.usingAdmin().createRandomTestUser();
|
||||
UserModel anotherUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -107,12 +145,17 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
dataSite.usingUser(anotherUser).usingSite(siteModel2).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(userAuth).withCoreAPI().usingUser(anotherUser).removeFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)")
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)")
|
||||
public void managerUserNotAuthorizedFailsToRemoveFavoriteSite() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -122,6 +165,11 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
managerUser.setPassword("newpassword");
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ public class DeleteSiteMembershipRequestSanityTests extends RestTest
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser()).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
import org.alfresco.rest.model.RestSiteModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
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.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Bogdan Bocancea
|
||||
*/
|
||||
public class GetFavoriteSiteFullTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel site1;
|
||||
private RestSiteModel restSiteModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
site1 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
dataSite.usingUser(userModel).usingSite(site1).addSiteToFavorites();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when personId is invalid")
|
||||
public void getFavoriteSiteWithInvalidPersonId() throws Exception
|
||||
{
|
||||
UserModel userSpecialChars = dataUser.usingAdmin().createUser(RandomStringUtils.randomAlphabetic(2) + "~!@#$%^&*()_+[]{}|;'d", "password");
|
||||
userSpecialChars.setUsername(RandomStringUtils.randomAlphabetic(2) + "~!%40%23%24%25%5E%26*()_%2B%5B%5D%7B%7D%7C%5C%3B%27%3A%22%2C.%2F%3C%3E");
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userSpecialChars).getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, userSpecialChars.getUsername()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request with empty site id")
|
||||
public void getFavoriteSiteWithEmptySiteId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/favorite-sites/{siteId}?{parameters}",
|
||||
userModel.getUsername(), "", restClient.getParameters());
|
||||
RestSiteModelsCollection sites = restClient.processModels(RestSiteModelsCollection.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
sites.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 401 when user is empty")
|
||||
public void getFavoriteSiteWithEmptyPersonId() throws Exception
|
||||
{
|
||||
UserModel emptyUser = new UserModel("", "password");
|
||||
restClient.authenticateUser(emptyUser).withCoreAPI().usingAuthUser().getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when another user get favorite site of an user")
|
||||
public void getFavoriteSiteWithAnotherUser() throws Exception
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(user).withCoreAPI().usingAuthUser().getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, user.getUsername(), site1.getId()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.RELATIONSHIP_NOT_FOUND_ERRORKEY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request returns status 200 when using -me-")
|
||||
public void getFavoriteSiteUsingMe() throws Exception
|
||||
{
|
||||
restSiteModel = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(site1.getId())
|
||||
.and().field("title").is(site1.getTitle());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify entry details for get site favorite response with Rest API")
|
||||
public void checkResponseSchemaForGetSiteFavorite() throws Exception
|
||||
{
|
||||
restSiteModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(site1.getId())
|
||||
.and().field("title").is(site1.getTitle())
|
||||
.and().field("role").is(UserRole.SiteManager.toString())
|
||||
.and().field("visibility").is(Visibility.PUBLIC.toString())
|
||||
.and().field("guid").isNotEmpty()
|
||||
.and().field("description").is(site1.getDescription())
|
||||
.and().field("preset").is("site-dashboard");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when providing folder name instead of site id")
|
||||
public void getFavoriteSiteUsingFolder() throws Exception
|
||||
{
|
||||
FolderModel folder = dataContent.usingUser(userModel).usingSite(site1).createFolder();
|
||||
SiteModel siteFolder = new SiteModel(folder.getName());
|
||||
restSiteModel = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getFavoriteSite(siteFolder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), folder.getName()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request returns status 200 when using valid parameters")
|
||||
public void getFavoriteSiteUsingParameters() throws Exception
|
||||
{
|
||||
restSiteModel = restClient.withParams("maxItems=100").authenticateUser(userModel).withCoreAPI().usingMe().getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(site1.getId())
|
||||
.and().field("title").is(site1.getTitle());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request returns status 400 when using maxItems=0")
|
||||
public void getFavoriteSiteUsingInvalidMaxItems() throws Exception
|
||||
{
|
||||
restSiteModel = restClient.withParams("maxItems=0").authenticateUser(userModel).withCoreAPI().usingMe().getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request returns status 401 when using invalid network")
|
||||
public void getFavoriteSiteUsingInvalidNetwork() throws Exception
|
||||
{
|
||||
UserModel invalidUserNetwork = dataUser.createRandomTestUser();
|
||||
SiteModel site = dataSite.usingUser(invalidUserNetwork).createPublicRandomSite();
|
||||
dataSite.usingUser(invalidUserNetwork).usingSite(site).addSiteToFavorites();
|
||||
invalidUserNetwork.setDomain("invalidNetwork");
|
||||
restSiteModel = restClient.authenticateUser(invalidUserNetwork).withCoreAPI().usingMe().getFavoriteSite(site);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -131,6 +131,7 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
managerUser.setPassword("newpassword");
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class GetFavoriteSitesCoreTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(testUser1).getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.PERMISION_DENIED_ERRORKEY)
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
@@ -76,7 +76,7 @@ public class GetFavoriteSitesCoreTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(testUser1).withCoreAPI().usingUser(dataUser.getAdminUser()).getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.PERMISION_DENIED_ERRORKEY)
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
|
||||
@@ -143,8 +143,7 @@ public class GetFavoriteSitesFullTests extends RestTest
|
||||
RestSiteModel restSiteModel = restClient.authenticateUser(userModel).withParams("properties=title")
|
||||
.withCoreAPI().usingAuthUser().getFavoriteSites().getOneRandomEntry().onModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().fieldCount().is(1)
|
||||
.assertThat().field("title").is(siteModel.getTitle());
|
||||
restSiteModel.assertThat().fieldsCount().is(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -153,7 +152,7 @@ public class GetFavoriteSitesFullTests extends RestTest
|
||||
public void getFavoriteSitesRequestWithInvalidPropertiesParam() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withParams("properties=tas").withCoreAPI().usingAuthUser()
|
||||
.getFavoriteSites().getOneRandomEntry().onModel().assertThat().fieldCount().is(0);
|
||||
.getFavoriteSites().getOneRandomEntry().onModel().assertThat().fieldsCount().is(0);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ public class GetFavoriteSitesSanityTests extends RestTest
|
||||
anyUser.setPassword("newpassword");
|
||||
|
||||
restClient.authenticateUser(anyUser).withCoreAPI().usingAuthUser().getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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().getPersonActivitiesUntilEntriesCountIs(4);
|
||||
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 userGetPeopleActivitiesUsingInvalidSkipCountParameter() 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 userGetPeopleActivitiesUsingInvalidMaxItemsParameter() 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 userGetsPeopleActivitiesUsingInvalidValueForWhoParameter() 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());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestActivityModel;
|
||||
import org.alfresco.rest.model.RestActivityModelsCollection;
|
||||
import org.alfresco.rest.model.RestActivitySummaryModel;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.ActivityType;
|
||||
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.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class GetPeopleActivitiesFullTests 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().getPersonActivitiesUntilEntriesCountIs(4);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("4");
|
||||
}
|
||||
|
||||
@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 its activities using me with Rest API and response is successful")
|
||||
public void userGetsItsPeopleActivitiesUsingMe() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("4");
|
||||
|
||||
List<RestActivitySummaryModel> allActivitySummary = new ArrayList<RestActivitySummaryModel>();
|
||||
for (RestActivityModel activityModel: restActivityModelsCollection.getEntries())
|
||||
{
|
||||
allActivitySummary.add(activityModel.onModel().getActivitySummary());
|
||||
}
|
||||
|
||||
assertActivitySummaryTitleIsPresent(allActivitySummary, fileInSite1.getName());
|
||||
assertActivitySummaryTitleIsPresent(allActivitySummary, folderInSite2.getName());
|
||||
assertActivitySummaryTitleIsPresent(allActivitySummary, fileInSite2.getName());
|
||||
restActivityModelsCollection.assertThat().entriesListContains("activityType", ActivityType.USER_JOINED.toString());
|
||||
}
|
||||
|
||||
@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 activity summary from user gets activities response with Rest API")
|
||||
public void userGetPeopleActivitiesWithActivitySummaryCheck() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("4");
|
||||
RestActivitySummaryModel summary = restActivityModelsCollection.getEntries().get(0).onModel().getActivitySummary();
|
||||
summary.assertThat().field("firstName").is(managerUser.getUsername() + " FirstName")
|
||||
.and().field("lastName").is("LN-" + managerUser.getUsername())
|
||||
.and().field("memberFirstName").is(managerUser.getUsername() + " FirstName")
|
||||
.and().field("role").is(managerUser.getUserRole())
|
||||
.and().field("memberLastName").is("LN-" + managerUser.getUsername())
|
||||
.and().field("title").is(String.format("%s FirstName LN-%s (%s)", managerUser.getUsername(), managerUser.getUsername(), managerUser.getUsername()))
|
||||
.and().field("memberPersonId").is(managerUser.getUsername());
|
||||
}
|
||||
|
||||
@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 400")
|
||||
public void userCannotGetPeopleActivitiesForEmptyPersonId() throws Exception
|
||||
{
|
||||
UserModel emptyUserName = new UserModel("", "password");
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(emptyUserName).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.LOCAL_NAME_CONSISTANCE)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
|
||||
@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' value with Rest API")
|
||||
public void userGetsPeopleActivitiesUsingMeForWhoParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).usingParams("who=me").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("2");
|
||||
restActivityModelsCollection.assertThat().entriesListContains("postPersonId", userModel.getUsername().toLowerCase())
|
||||
.and().entriesListDoesNotContain("postPersonId", adminUser.getUsername().toLowerCase())
|
||||
.and().entriesListDoesNotContain("postPersonId", managerUser.getUsername().toLowerCase());
|
||||
}
|
||||
|
||||
@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 its activities for siteId specified in siteId parameter using me with Rest API and response is successful")
|
||||
public void userGetItsPeopleActivitiesForASpecificSite() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).usingParams(String.format("siteId=%s", siteModel1.getId())).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("1");
|
||||
restActivityModelsCollection.assertThat().entriesListContains("siteId", siteModel1.getId())
|
||||
.and().entriesListDoesNotContain("siteId", siteModel2.getId());
|
||||
}
|
||||
|
||||
@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 for user with no activities with Rest API and response is successful")
|
||||
public void userGetPeopleActivitiesForUserWithNoActivities() throws Exception
|
||||
{
|
||||
UserModel userNoActivities = dataUser.createRandomTestUser();
|
||||
dataSite.usingUser(userNoActivities).createPublicRandomSite();
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(userNoActivities).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("0");
|
||||
restActivityModelsCollection.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
private void assertActivitySummaryTitleIsPresent(List<RestActivitySummaryModel> allActivitySummary, String title)
|
||||
{
|
||||
for (RestActivitySummaryModel activitySummary: allActivitySummary)
|
||||
{
|
||||
if (activitySummary.getTitle().equals(title))
|
||||
{
|
||||
Assert.assertEquals(activitySummary.getTitle(), title, String.format("%s title was not found in Activity Summary", title));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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 siteId that user doesn't have access to with Rest API and response is not found")
|
||||
public void userGetPeopleActivitiesForASiteWithNoAccess() throws Exception
|
||||
{
|
||||
SiteModel siteNoAccess = dataSite.usingUser(managerUser).createPrivateRandomSite();
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).usingParams(String.format("siteId=%s", siteNoAccess.getId())).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, siteNoAccess.getId()));
|
||||
}
|
||||
|
||||
@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 another user with Rest API and response is permission denied")
|
||||
public void userGetPeopleActivitiesForAnotherUser() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerUser).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@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 with properties parameter applied with Rest API and response is successful")
|
||||
public void userGetPeopleActivitiesUsingPropertiesParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("properties=postPersonId").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("4");
|
||||
restActivityModelsCollection.assertThat().entriesListContains("postPersonId", userModel.getUsername().toLowerCase())
|
||||
.and().entriesListContains("postPersonId", adminUser.getUsername().toLowerCase())
|
||||
.and().entriesListContains("postPersonId", managerUser.getUsername().toLowerCase())
|
||||
.and().entriesListDoesNotContain("postedAt")
|
||||
.and().entriesListDoesNotContain("feedPersonId")
|
||||
.and().entriesListDoesNotContain("siteId")
|
||||
.and().entriesListDoesNotContain("activitySummary")
|
||||
.and().entriesListDoesNotContain("id")
|
||||
.and().entriesListDoesNotContain("activityType");
|
||||
}
|
||||
|
||||
@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 with skipCount parameter applied with Rest API and response is successful")
|
||||
public void userGetPeopleActivitiesUsingSkipCountParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("skipCount=2").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("2");
|
||||
restActivityModelsCollection.getEntries().get(0).onModel().assertThat().field("postPersonId").is(userModel.getUsername().toLowerCase())
|
||||
.and().field("activityType").is(ActivityType.FOLDER_ADDED.toString());
|
||||
restActivityModelsCollection.getEntries().get(1).onModel().assertThat().field("postPersonId").is(userModel.getUsername().toLowerCase())
|
||||
.and().field("activityType").is(ActivityType.FILE_ADDED.toString());
|
||||
}
|
||||
|
||||
@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 with maxItems parameter applied with Rest API and response is successful")
|
||||
public void userGetPeopleActivitiesUsingMaxItemsParameter() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("maxItems=2").getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().paginationField("count").is("2");
|
||||
restActivityModelsCollection.getEntries().get(0).onModel().assertThat().field("postPersonId").is(managerUser.getUsername().toLowerCase())
|
||||
.and().field("activityType").is(ActivityType.USER_JOINED.toString());
|
||||
restActivityModelsCollection.getEntries().get(1).onModel().assertThat().field("postPersonId").is(adminUser.getUsername().toLowerCase())
|
||||
.and().field("activityType").is(ActivityType.FILE_ADDED.toString());
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,10 @@ 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().getPersonActivitiesUntilEntriesCountIs(5);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestPersonModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class GetPeoplePreferenceCoreTests extends RestTest
|
||||
{
|
||||
UserModel secondUser = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(secondUser).withCoreAPI().usingUser(userModel)
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
restClient.assertLastError().containsSummary("Permission was denied");
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class GetPeoplePreferenceCoreTests extends RestTest
|
||||
public void statusNotFoundIsReturnedForAPersonIDThatDoesNotExist() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(new UserModel("invalidPersonID", "password"))
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary("The entity with id: invalidPersonID was not found");
|
||||
}
|
||||
@@ -57,17 +57,17 @@ public class GetPeoplePreferenceCoreTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify manager fails to get a specific preference for an removed preference with Rest API and response is 404")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify manager fails to get a specific preference for removed preference with Rest API and response is 404")
|
||||
public void statusNotFoundIsReturnedForAPreferenceNameThatHasBeenRemoved() throws Exception
|
||||
{
|
||||
SiteModel preferenceSite = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
dataSite.usingUser(userModel).usingSite(preferenceSite).addSiteToFavorites();
|
||||
dataSite.usingUser(userModel).usingSite(preferenceSite).removeSiteFromFavorites();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + preferenceSite.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), preferenceSite.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", userModel.getUsername(),
|
||||
PreferenceName.SITES_FAVORITES_PREFIX + preferenceSite.getId()));
|
||||
String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), preferenceSite.getId())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), 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(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), 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(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||
.and().field("value").isNull();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(userModel).withParams("properties=id,value").withCoreAPI().usingUser(userModel)
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), 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(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), 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(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), 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);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestPreferenceModel;
|
||||
import org.alfresco.utility.constants.PreferenceName;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
@@ -42,9 +43,9 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -56,9 +57,9 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataSite.usingUser(collaboratorUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -70,9 +71,9 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataSite.usingUser(contributorUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -84,9 +85,9 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataSite.usingUser(consumerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(),siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(),siteModel.getId())).and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -97,9 +98,9 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataSite.usingUser(adminUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(adminUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -113,7 +114,8 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
managerUser.setPassword("newpassword");
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
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.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 GetPeoplePreferencesCoreTests 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.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets its preferences with invalid maxItems parameter with Rest API and response is 400")
|
||||
public void userGetsPeoplePreferencesUsingInvalidMaxItemsParameter() throws Exception
|
||||
{
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingMe().usingParams("maxItems=0").getPersonPreferences();
|
||||
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.PREFERENCES, TestGroup.CORE })
|
||||
@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 userGetsPeoplePreferencesUsingInvalidSkipCountParameter() throws Exception
|
||||
{
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingMe().usingParams("skipCount=-1").getPersonPreferences();
|
||||
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.PREFERENCES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user which doesn't have access to another user preferences fails to get its preferences with Rest API and response is permission denied")
|
||||
public void userWithNoAccessToOtherUserPreferencesIsForbiddenToGetItsPreferences() throws Exception
|
||||
{
|
||||
UserModel noAccessUser = dataUser.createRandomTestUser();
|
||||
dataSite.usingUser(noAccessUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingUser(noAccessUser).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.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user fails to get preferences for inexistent personId with Rest API and response is 404")
|
||||
public void userCannotGetPeoplePreferencesForInexistentPersonId() throws Exception
|
||||
{
|
||||
UserModel inexistentUserName = new UserModel("inexistent", "password");
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingUser(inexistentUserName).getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.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.PREFERENCES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user get preferences for a user with no preferences with Rest API and response is empty")
|
||||
public void userGetsPeoplePreferencesForUserWithNoPreferences() throws Exception
|
||||
{
|
||||
UserModel userNoActivities = dataUser.createRandomTestUser();
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(userNoActivities).getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().paginationField("count").is("0");
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user fails to get preferences for a removed preference with Rest API and response is 404")
|
||||
public void userFailsToGetPeoplePreferencesIfPreferenceWasRemoved() throws Exception
|
||||
{
|
||||
SiteModel preferenceSite = dataSite.usingUser(user1).createPublicRandomSite();
|
||||
dataSite.usingUser(user1).usingSite(preferenceSite).addSiteToFavorites();
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().paginationField("count").is("6");
|
||||
|
||||
dataSite.usingUser(user1).usingSite(preferenceSite).removeSiteFromFavorites();
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(user1).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().paginationField("count").is("5");
|
||||
restPreferenceModelsCollection.assertThat().entriesListDoesNotContain("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), preferenceSite.getId()));
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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.constants.UserRole;
|
||||
@@ -44,7 +45,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.entriesListContains("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -58,7 +59,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.entriesListContains("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -72,7 +73,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.entriesListContains("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -86,7 +87,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.entriesListContains("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -101,7 +102,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(managerUser).getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
.entriesListContains("id", String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@@ -115,6 +116,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
managerUser.setPassword("newpassword");
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class GetSiteMembershipCoreTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@Bug(id = "REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
// @Bug(id = "REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify get site membership for a site returns status 404 when personId does not exist.")
|
||||
public void getSiteMembershipUsingNonExistentPersonId() throws Exception
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GetSiteMembershipRequestCoreTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify contributor user fails to get all site membership requests of a specific person with Rest API when the authentication fails (401)")
|
||||
@Bug(id = "16904")
|
||||
@Bug(id = "MNT-16904")
|
||||
public void unauthorizedContributorUserFailsToGetSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel contributor = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -71,7 +71,8 @@ public class GetSiteMembershipRequestCoreTests extends RestTest
|
||||
dataUser.usingUser(userModel).addUserToSite(consumer, siteModel, UserRole.SiteContributor);
|
||||
consumer.setPassword("newpassword");
|
||||
restClient.authenticateUser(consumer).withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
|
||||
@@ -35,30 +35,46 @@ public class GetSiteMembershipRequestsCoreTests extends RestTest
|
||||
newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify that for invalid maxItems parameter status code returned is 400.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that for invalid maxItems parameter status code returned is 400.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void checkInvalidMaxItemsStatusCode() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser).withParams("maxItems=AB").withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
|
||||
restClient.authenticateUser(adminUser).withParams("maxItems=AB")
|
||||
.withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "AB"));
|
||||
|
||||
restClient.authenticateUser(adminUser).withParams("maxItems=0")
|
||||
.withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify that for invalid skipCount parameter status code returned is 400.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that for invalid skipCount parameter status code returned is 400.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void checkInvalidSkipCountStatusCode() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser).withParams("skipCount=AB").withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
|
||||
restClient.authenticateUser(adminUser).withParams("skipCount=AB")
|
||||
.withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "AB"));
|
||||
|
||||
restClient.authenticateUser(adminUser).withParams("skipCount=-1")
|
||||
.withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify that if personId does not exist status code returned is 404.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that if personId does not exist status code returned is 404.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void ifPersonIdDoesNotExist() throws Exception
|
||||
{
|
||||
@@ -66,11 +82,17 @@ public class GetSiteMembershipRequestsCoreTests extends RestTest
|
||||
nonexistentUser.setUsername("nonexistent");
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(nonexistentUser).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "nonexistent"));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "nonexistent"))
|
||||
.statusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Specify -me- string in place of <personid> for request.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Specify -me- string in place of <personid> for request.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void replacePersonIdWithMeRequest() throws Exception
|
||||
{
|
||||
@@ -81,7 +103,9 @@ public class GetSiteMembershipRequestsCoreTests extends RestTest
|
||||
returnedCollection.assertThat().entriesListContains("id", moderatedSite.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify that if empty personId is used status code returned is 404.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that if empty personId is used status code returned is 404.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void useEmptyPersonId() throws Exception
|
||||
{
|
||||
@@ -89,11 +113,13 @@ public class GetSiteMembershipRequestsCoreTests extends RestTest
|
||||
emptyNameMember.setUsername(" ");
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(emptyNameMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary("The entity with id: " + emptyNameMember.getUsername() + " was not found");
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, emptyNameMember.getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Get site membership requests to a public site.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Get site membership requests to a public site.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void getRequestsToPublicSite() throws Exception
|
||||
{
|
||||
@@ -105,8 +131,9 @@ public class GetSiteMembershipRequestsCoreTests extends RestTest
|
||||
returnedCollection.assertThat().entriesListDoesNotContain("id", publicSite.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Get site membership requests to a moderated site.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Get site membership requests to a moderated site.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void getRequestsToModeratedSite() throws Exception
|
||||
{
|
||||
@@ -117,7 +144,9 @@ public class GetSiteMembershipRequestsCoreTests extends RestTest
|
||||
returnedCollection.assertThat().entriesListContains("id", moderatedSite.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Approve request then get requests.")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Approve request then get requests.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void approveRequestThenGetRequests() throws Exception
|
||||
{
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteMembershipRequestModel;
|
||||
import org.alfresco.rest.model.RestSiteMembershipRequestModelsCollection;
|
||||
import org.alfresco.rest.model.RestTaskModel;
|
||||
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 1/10/2017.
|
||||
*/
|
||||
public class GetSiteMembershipRequestsFullTests extends RestTest
|
||||
{
|
||||
UserModel siteManager, newMember, adminUser, regularUser;
|
||||
SiteModel moderatedSite1, moderatedSite2, publicSite, privateSite;
|
||||
RestSiteMembershipRequestModelsCollection siteMembershipRequests;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
moderatedSite1 = dataSite.usingUser(siteManager).createModeratedRandomSite();
|
||||
moderatedSite2 = dataSite.usingUser(siteManager).createModeratedRandomSite();
|
||||
privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
|
||||
adminUser = dataUser.getAdminUser();
|
||||
newMember = dataUser.createRandomTestUser();
|
||||
regularUser = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user gets all its own site membership requests with Rest API and response is successful (200)")
|
||||
public void adminGetsItsOwnSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
siteMembershipRequests = restClient.authenticateUser(adminUser).withCoreAPI().usingAuthUser().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListContains("id", moderatedSite1.getId())
|
||||
.assertThat().entriesListContains("id", moderatedSite2.getId());
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16557")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user fails to get all site membership requests of another user with Rest API (403)")
|
||||
public void regularUserFailsToGetSiteMembershipRequestsOfAnotherUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16557")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user fails to get all site membership requests of admin with Rest API (403)")
|
||||
public void regularUserFailsToGetSiteMembershipRequestsOfAdmin() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withCoreAPI()
|
||||
.usingUser(adminUser).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user is able to get his site membership requests with, but skip the first one")
|
||||
public void getSiteMembershipRequestsButSkipTheFirstOne() throws Exception
|
||||
{
|
||||
siteMembershipRequests = restClient.authenticateUser(newMember).withParams("orderBy=id ASC").withCoreAPI()
|
||||
.usingMe().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListContains("id", moderatedSite1.getId())
|
||||
.assertThat().entriesListContains("id", moderatedSite2.getId());
|
||||
|
||||
RestSiteMembershipRequestModel firstSiteMembershipRequest = siteMembershipRequests.getEntries().get(0).onModel();
|
||||
|
||||
siteMembershipRequests = restClient.authenticateUser(newMember).withParams("orderBy=id ASC&skipCount=1").withCoreAPI()
|
||||
.usingMe().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListDoesNotContain("id", firstSiteMembershipRequest.getId())
|
||||
.assertThat().entriesListContains("id", moderatedSite2.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user is able to get his site membership requests with higher skipCount than number of requests")
|
||||
public void getSiteMembershipRequestsWithHighSkipCount() throws Exception
|
||||
{
|
||||
siteMembershipRequests = restClient.authenticateUser(newMember).withParams("skipCount=3").withCoreAPI()
|
||||
.usingMe().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get site membership requests returns an empty list where there are no requests")
|
||||
public void getSiteMembershipRequestsWhereThereAreNoRequests() throws Exception
|
||||
{
|
||||
siteMembershipRequests = restClient.authenticateUser(regularUser).withCoreAPI().usingMe().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Reject request then get site membership requests.")
|
||||
public void rejectRequestThenGetSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel userWithRejectedRequests = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(userWithRejectedRequests).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
RestTaskModel taskModel = restClient.authenticateUser(userWithRejectedRequests).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite1);
|
||||
workflow.approveSiteMembershipRequest(siteManager.getUsername(), siteManager.getPassword(), taskModel.getId(), false, "Rejected");
|
||||
|
||||
siteMembershipRequests = restClient.authenticateUser(userWithRejectedRequests).withCoreAPI().usingMe().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListDoesNotContain("id", moderatedSite1.getId())
|
||||
.assertThat().entriesListContains("id", moderatedSite2.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Check get site membership requests when properties parameter is used")
|
||||
public void getSiteMembershipRequestsWithProperties() throws Exception
|
||||
{
|
||||
siteMembershipRequests = restClient.authenticateUser(newMember).withParams("properties=id")
|
||||
.withCoreAPI().usingAuthUser().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListContains("id", moderatedSite1.getId())
|
||||
.assertThat().entriesListContains("id", moderatedSite2.getId());
|
||||
RestSiteMembershipRequestModel siteMembershipRequest = siteMembershipRequests.getOneRandomEntry().onModel();
|
||||
siteMembershipRequest.assertThat().fieldsCount().is(1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteMembershipRequestModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
@@ -10,7 +12,6 @@ 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.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -22,21 +23,21 @@ import org.testng.annotations.Test;
|
||||
|
||||
public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel siteModel;
|
||||
UserModel newMember;
|
||||
UserModel siteManager, newMember;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
SiteModel moderatedSite;
|
||||
RestSiteMembershipRequestModelsCollection siteMembershipRequests;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
String siteId = RandomData.getRandomName("site");
|
||||
siteModel = dataSite.usingUser(userModel).createSite(new SiteModel(Visibility.MODERATED, siteId, siteId, siteId, siteId));
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
moderatedSite = dataSite.usingUser(siteManager).createModeratedRandomSite();
|
||||
newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(moderatedSite, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@@ -44,11 +45,10 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets all site membership requests of a specific person with Rest API and response is successful (200)")
|
||||
public void managerUserGetsSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
siteMembershipRequests = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@@ -56,10 +56,8 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user fails to get all site membership requests of another user with Rest API (403)")
|
||||
public void collaboratorUserFailsToGetSiteMembershipRequestsOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(collaboratorUser, siteModel, UserRole.SiteCollaborator);
|
||||
|
||||
restClient.authenticateUser(collaboratorUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@@ -68,10 +66,8 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user fails to get all site membership requests of another user with Rest API (403)")
|
||||
public void contributorUserFailsToGetSiteMembershipRequestsOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
|
||||
|
||||
restClient.authenticateUser(contributorUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@@ -80,10 +76,7 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user fails to get all site membership requests of another user with Rest API (403)")
|
||||
public void consumerUserFailsToGetSiteMembershipRequestsOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel, UserRole.SiteConsumer);
|
||||
|
||||
restClient.authenticateUser(consumerUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@@ -92,29 +85,37 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets all site membership requests of a specific person with Rest API and response is successful (200)")
|
||||
public void adminUserGetsSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
siteMembershipRequests = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user fails to get all site membership requests of a specific person with Rest API when the authentication fails (401)")
|
||||
public void managerUserNotAuthorizedFailsToGetSiteMembershipRequests() throws Exception
|
||||
public void unauthorizedUserFailsToGetSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
managerUser.setPassword("newpassword");
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI()
|
||||
.usingAuthUser().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify a user gets all its own site membership requests with Rest API and response is successful (200)")
|
||||
public void oneUserGetsItsOwnSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
siteMembershipRequests = restClient.authenticateUser(newMember).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembershipRequests.assertThat().entriesListContains("id", moderatedSite.getId())
|
||||
.assertThat().entriesListContains("message", "Please accept me")
|
||||
.assertThat().entriesListCountIs(1);
|
||||
siteMembershipRequests.getEntries().get(0).onModel().getSite()
|
||||
.assertThat().field("visibility").is(moderatedSite.getVisibility())
|
||||
.assertThat().field("guid").is(moderatedSite.getGuid())
|
||||
.assertThat().field("description").is(moderatedSite.getDescription())
|
||||
.assertThat().field("id").is(moderatedSite.getId())
|
||||
.assertThat().field("title").is(moderatedSite.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.people;
|
||||
|
||||
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.exception.DataPreparationException;
|
||||
@@ -84,6 +85,7 @@ public class GetSiteMembershipSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI()
|
||||
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).getSiteMembership(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -2,6 +2,7 @@ package org.alfresco.rest.people;
|
||||
|
||||
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.exception.DataPreparationException;
|
||||
@@ -83,6 +84,7 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "wrong password");
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.getSitesMembershipInformation();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.ratings;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestRatingModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
@@ -123,7 +124,8 @@ public class AddRatingSanityTests extends RestTest
|
||||
FileModel document = dataContent.usingUser(userModel).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingResource(document).likeDocument();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -206,6 +208,7 @@ public class AddRatingSanityTests extends RestTest
|
||||
FileModel document = dataContent.usingUser(userModel).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingResource(document).rateStarsToDocument(5);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.ratings;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestRatingModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
@@ -177,10 +178,12 @@ public class DeleteRatingSanityTests extends RestTest
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
|
||||
restClient.withCoreAPI().usingResource(document).deleteLikeRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
|
||||
restClient.withCoreAPI().usingResource(document).deleteFiveStarRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify one user is not able to remove rating added by another user")
|
||||
|
||||
@@ -144,6 +144,7 @@ public class GetRatingsSanityTests extends RestTest
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
|
||||
restClient.withCoreAPI().usingResource(document).getRatings();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.sites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
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;
|
||||
@@ -111,6 +112,7 @@ public class AddSiteMemberSanityTests extends RestTest
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser)
|
||||
.withCoreAPI().usingSite(siteModel).addPerson(testUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.sites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteContainerModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
@@ -112,6 +113,7 @@ public class GetSiteContainerSanityTests extends RestTest
|
||||
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.sites;
|
||||
|
||||
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;
|
||||
@@ -108,6 +109,7 @@ public class GetSiteContainersSanityTests extends RestTest
|
||||
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI().usingSite(siteModel).getSiteContainers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.sites;
|
||||
|
||||
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.exception.DataPreparationException;
|
||||
@@ -105,6 +106,7 @@ public class GetSiteMemberSanityTests extends RestTest
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser);
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSiteMember(userModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.sites;
|
||||
|
||||
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.exception.DataPreparationException;
|
||||
@@ -104,6 +105,7 @@ public class GetSiteMembersSanityTests extends RestTest
|
||||
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI().usingSite(siteModel).getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.sites;
|
||||
|
||||
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.exception.DataPreparationException;
|
||||
@@ -113,6 +114,7 @@ public class GetSiteSanityTests extends RestTest
|
||||
restClient.authenticateUser(userModel).withParams("maxItems=10000")
|
||||
.withCoreAPI()
|
||||
.getSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.sites;
|
||||
|
||||
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;
|
||||
@@ -110,6 +111,7 @@ public class GetSitesSanityTests extends RestTest
|
||||
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel).withParams("maxItems=1")
|
||||
.withCoreAPI().getSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.sites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
@@ -125,6 +126,7 @@ public class RemoveSiteMemberSanityTests extends RestTest
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class UpdateSiteMemberCoreTests extends RestTest
|
||||
.assertLastError().containsSummary("User is not a member of the site");
|
||||
}
|
||||
|
||||
@Bug(id="REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
// @Bug(id="REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.CORE })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 404 when personId does not exist")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.sites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
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;
|
||||
@@ -108,6 +109,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
|
||||
restClient.authenticateUser(inexistentUser);
|
||||
testUserModel.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class AddTagSanityTests extends RestTest
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager);
|
||||
restClient.withCoreAPI().usingResource(document).addTag("tagUnauthorized");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,7 @@ public class AddTagsSanityTests extends RestTest
|
||||
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager).withCoreAPI().usingResource(document).addTags(tag1, tag2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,7 @@ public class DeleteTagSanityTests extends RestTest
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager);
|
||||
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.alfresco.rest.tags;
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTagModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
@@ -124,6 +125,7 @@ public class GetNodeTagsSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
restClient.withCoreAPI().usingResource(document).getNodeTags();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.alfresco.rest.tags;
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTagModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
@@ -120,7 +121,8 @@ public class GetTagSanityTests extends RestTest
|
||||
managerUser.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(managerUser);
|
||||
restClient.withCoreAPI().getTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.alfresco.rest.tags;
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTagModelsCollection;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
@@ -118,6 +119,7 @@ public class GetTagsSanityTests extends RestTest
|
||||
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().getTags();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ public class UpdateTagSanityTests extends RestTest
|
||||
siteManager.setPassword("wrongPassword");
|
||||
restClient.authenticateUser(siteManager);
|
||||
restClient.withCoreAPI().usingTag(oldTag).update(randomTag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,7 @@ public class GetDeploymentsSanityTests extends RestTest
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.DEPLOYMENTS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Admin user gets non-network deployments using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS, TestGroup.SANITY})
|
||||
public void getNonNetworkDeploymentsWithAdmin() throws JsonToModelConversionException, Exception
|
||||
@@ -38,8 +37,7 @@ public class GetDeploymentsSanityTests extends RestTest
|
||||
deployments.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.DEPLOYMENTS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Tenant Admin user gets network deployments using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS, TestGroup.SANITY, TestGroup.NETWORKS})
|
||||
public void getNetworkDeploymentsWithAdmin() throws JsonToModelConversionException, Exception
|
||||
|
||||
@@ -79,6 +79,7 @@ public class AddTaskVariablesCoreTests extends RestTest
|
||||
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION, description = "Adding task variable is falling in case incomplete body - missing required: name type is provided")
|
||||
public void failedAddingTaskVariableIfIncompleteRequiredBodyIsProvided() throws Exception
|
||||
{
|
||||
@@ -103,6 +104,7 @@ public class AddTaskVariablesCoreTests extends RestTest
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5674")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION, description = "Adding task variable is falling in case invalid type prefix is provided")
|
||||
public void failedAddingTaskVariableIfInvalidTypePrefixIsProvided() throws Exception
|
||||
{
|
||||
|
||||
@@ -120,6 +120,7 @@ public class DeleteTaskVariableCoreTests extends RestTest
|
||||
.withWorkflowAPI()
|
||||
.usingTask(taskModel)
|
||||
.deleteTaskVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,21 +56,11 @@ public class GetTasksCoreTests extends RestTest
|
||||
TestGroup.TASKS }, executionType = ExecutionType.REGRESSION, description = "Check that orderBy parameter is applied.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
public void orderByParameterApplied() throws Exception
|
||||
{
|
||||
|
||||
|
||||
taskModels = restClient.authenticateUser(dataUser.getAdminUser()).withParams("orderBy=id DESC").withWorkflowAPI().getTasks();
|
||||
{
|
||||
taskModels = restClient.authenticateUser(dataUser.getAdminUser()).withParams("orderBy=id").withWorkflowAPI().getTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
taskModels.assertThat().entriesListIsNotEmpty().
|
||||
and().entriesListIsSortedAscBy("id");
|
||||
List<RestTaskModel> tasksList = taskModels.getEntries();
|
||||
List<String> taskIds = new ArrayList<String>();
|
||||
for(RestTaskModel task: tasksList)
|
||||
{
|
||||
taskIds.add(task.onModel().getId());
|
||||
}
|
||||
boolean sorted = Ordering.natural().isOrdered(taskIds);
|
||||
Assert.assertTrue(sorted, "Tasks list should be ordered ascendent after id");
|
||||
and().entriesListIsSortedAscBy("id");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW,
|
||||
|
||||
@@ -129,7 +129,8 @@ public class RemoveTaskItemCoreTests extends RestTest
|
||||
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
taskItem = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI().usingTask(taskModel).addTaskItem(document2);
|
||||
restClient.authenticateUser(UserModel.getRandomUserModel()).withWorkflowAPI().usingTask(taskModel).deleteTaskItem(taskItem);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
|
||||
@@ -107,7 +107,7 @@ public class UpdateTaskCoreTestsBulk3 extends RestTest
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, postBody, "tasks/{taskId}?{parameters}", taskModel.getId(), restClient.getParameters());
|
||||
restTaskModel = restClient.processModel(RestTaskModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("priorityTask").is(CMISUtil.Priority.Low.getLevel());
|
||||
restTaskModel.assertThat().field("priority").is(CMISUtil.Priority.Low.getLevel());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
|
||||
@@ -167,7 +167,8 @@ public class UpdateTaskVariableCoreTests extends RestTest
|
||||
variableModel.setName("new-name");
|
||||
taskVariable = restClient.authenticateUser(UserModel.getRandomUserModel())
|
||||
.withWorkflowAPI().usingTask(taskModel).updateTaskVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,13 +6,13 @@ log4j.appender.file=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.file.File=./target/reports/alfresco-tas.log
|
||||
log4j.appender.file.MaxBackupIndex=10
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
# Direct log messages to stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
log4j.appender.stdout.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
# TestRail particular log file
|
||||
# Direct log messages to a log file
|
||||
|
||||
Reference in New Issue
Block a user