mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch 'master' into networksSanity
This commit is contained in:
+1
-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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+13
-1
@@ -18,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;
|
||||
|
||||
@@ -81,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")
|
||||
@@ -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);
|
||||
|
||||
@@ -37,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());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -48,8 +47,12 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
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 })
|
||||
@@ -58,7 +61,9 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
public void userIsNotAbleToRemoveFavoriteSiteWithInexistentId() throws Exception
|
||||
{
|
||||
SiteModel inexistentSite = new SiteModel("inexistentSite");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).removeFavoriteSite(inexistentSite);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel)
|
||||
.removeFavoriteSite(inexistentSite);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
|
||||
@@ -77,7 +82,9 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
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);
|
||||
@@ -92,9 +99,12 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
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 })
|
||||
@@ -105,9 +115,12 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
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 })
|
||||
@@ -118,9 +131,12 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
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 })
|
||||
@@ -131,9 +147,12 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,12 +68,12 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
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());
|
||||
.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 })
|
||||
@@ -90,12 +90,12 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
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());
|
||||
.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 })
|
||||
@@ -112,12 +112,12 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
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());
|
||||
.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 })
|
||||
@@ -156,7 +156,6 @@ 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 is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)")
|
||||
@Bug(id = "MNT-16904")
|
||||
public void managerUserNotAuthorizedFailsToRemoveFavoriteSite() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user