mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch 'master' into networksCore
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")
|
||||
@@ -2,6 +2,9 @@ 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;
|
||||
@@ -14,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
|
||||
@@ -25,12 +29,13 @@ 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");
|
||||
@@ -43,7 +48,7 @@ public class RestGetNetworksForPersonSanityTests 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.FAVORITES, TestGroup.SANITY, TestGroup.COMMENTS, TestGroup.NETWORKS })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
@@ -53,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);
|
||||
@@ -63,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();
|
||||
@@ -73,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());
|
||||
}
|
||||
}
|
||||
@@ -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