groupping rest API in own DSL

updating test to use core or workflow API
This commit is contained in:
Paul Brodner
2016-11-16 16:00:42 +02:00
parent d1ff61e354
commit 4bdeb7587e
58 changed files with 816 additions and 686 deletions
@@ -1,64 +0,0 @@
package org.alfresco.rest;
import org.alfresco.rest.core.RestProperties;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.utility.data.DataUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.jayway.restassured.RestAssured;
@ContextConfiguration("classpath:alfresco-restapi-context.xml")
public class MySampleDSL extends AbstractTestNGSpringContextTests {
@Autowired
RestWrapper restAPI;
@Autowired
DataUser dataUser;
@Autowired
protected RestProperties restProperties;
@BeforeClass
public void asd() {
RestAssured.baseURI = restProperties.envProperty().getTestServerUrl();
RestAssured.port = restProperties.envProperty().getPort();
RestAssured.basePath = restProperties.getRestBasePath();
}
@Test
public void something() throws Exception {
// GET /Sites/<hahaha>/containers
restAPI.authenticateUser(dataUser.getAdminUser()).usingSite("workshop").getContainers().assertThat().entriesListIsNotEmpty();
// restAPI.usingSite("hahaha").getContainers().assertThat().field("level1").field("level2").field("level3").is("b")
// restAPI.usingSite("hahaha").getContainers().assertThat().field("level3").is("a");
// restAPI.usingSite("hahaha").getContainers().assertThat().listIsNotEmpty()
// .listContains(level)
// .statusCode().is(HttpStatus.OK);
//
//
//
// //GET /sites/{siteId}/containers/{containerId}
//
// restAPI.usingSite("haha").getContainer("c1").assertThat().file("folderId").is("jjsjsj");
// .statusCode().
//
//
// SiteModel site;
// String body = JsonBodyGenerator.siteMemberhipRequest("Please accept me", site, "New request");
// restAPI.usingPeople(people).withBody(body).addSiteMembershipRequest();
//
//
//
//
// restAPI.usingPeople(people).withBody(body).addSiteMembershipRequest().assertthat().statusCode().is().and().fiels
// restApi.getBodyResponse.
}
}
@@ -13,8 +13,6 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.BeforeClass;
import com.jayway.restassured.RestAssured;
@ContextConfiguration("classpath:alfresco-restapi-context.xml")
public abstract class RestTest extends AbstractTestNGSpringContextTests
{
@@ -46,9 +44,5 @@ public abstract class RestTest extends AbstractTestNGSpringContextTests
public void checkServerHealth() throws Exception
{
serverHealth.assertServerIsOnline();
RestAssured.baseURI = restProperties.envProperty().getTestServerUrl();
RestAssured.port = restProperties.envProperty().getPort();
RestAssured.basePath = restProperties.getRestBasePath();
}
}
@@ -2,22 +2,9 @@ package org.alfresco.rest;
import org.alfresco.utility.data.DataWorkflow;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.BeforeClass;
import com.jayway.restassured.RestAssured;
public abstract class RestWorkflowTest extends RestTest
{
@Autowired
protected DataWorkflow dataWorkflow;
@BeforeClass(alwaysRun = true)
public void checkServerHealth() throws Exception
{
serverHealth.assertServerIsOnline();
RestAssured.baseURI = restProperties.envProperty().getTestServerUrl();
RestAssured.port = restProperties.envProperty().getPort();
RestAssured.basePath = restProperties.getRestWorkflowPath();
}
protected DataWorkflow dataWorkflow;
}
@@ -4,7 +4,6 @@ import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.ErrorModel;
import org.alfresco.utility.model.FileModel;
@@ -14,7 +13,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -22,9 +20,6 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public class AddCommentSanityTests extends RestTest
{
@Autowired
DataUser dataUser;
private UserModel adminUserModel;
private FileModel document;
private SiteModel siteModel;
@@ -46,7 +41,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(adminUserModel);
String newContent = "This is a new comment added by " + adminUserModel.getUsername();
restClient.usingResource(document).addComment(newContent)
restClient.onCoreAPI().usingResource(document).addComment(newContent)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(newContent);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -57,7 +52,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
String contentSiteManger = "This is a new comment added by user with role: " + UserRole.SiteManager;
restClient.usingResource(document).addComment(contentSiteManger)
restClient.onCoreAPI().usingResource(document).addComment(contentSiteManger)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(contentSiteManger);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -68,7 +63,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
String contentSiteContributor = "This is a new comment added by user with role" + UserRole.SiteContributor;
restClient.usingResource(document).addComment(contentSiteContributor)
restClient.onCoreAPI().usingResource(document).addComment(contentSiteContributor)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(contentSiteContributor);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -79,7 +74,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
String contentSiteCollaborator = "This is a new comment added by user with role: " + UserRole.SiteCollaborator;
restClient.usingResource(document).addComment(contentSiteCollaborator)
restClient.onCoreAPI().usingResource(document).addComment(contentSiteCollaborator)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(contentSiteCollaborator);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -90,7 +85,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
String contentSiteConsumer = "This is a new comment added by user with role: " + UserRole.SiteConsumer;
restClient.usingResource(document).addComment(contentSiteConsumer);
restClient.onCoreAPI().usingResource(document).addComment(contentSiteConsumer);
restClient
.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
@@ -101,7 +96,7 @@ public class AddCommentSanityTests extends RestTest
public void unauthenticatedUserIsNotAbleToAddComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.usingResource(document).addComment("This is a new comment");
restClient.onCoreAPI().usingResource(document).addComment("This is a new comment");
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -14,7 +14,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
@@ -25,9 +24,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public class AddCommentsSanityTests extends RestTest
{
@Autowired DataUser dataUser;
{
private UserModel adminUserModel;
private FileModel document;
private SiteModel siteModel;
@@ -57,10 +54,10 @@ public class AddCommentsSanityTests extends RestTest
public void adminIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel)
.usingResource(document).addComments(comment1, comment2)
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
.onCoreAPI().usingResource(document).addComments(comment1, comment2)
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -69,7 +66,7 @@ public class AddCommentsSanityTests extends RestTest
public void managerIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.usingResource(document).addComments(comment1, comment2)
.onCoreAPI().usingResource(document).addComments(comment1, comment2)
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
@@ -81,7 +78,7 @@ public class AddCommentsSanityTests extends RestTest
public void contributorIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.usingResource(document).addComments(comment1, comment2)
.onCoreAPI().usingResource(document).addComments(comment1, comment2)
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
@@ -93,7 +90,7 @@ public class AddCommentsSanityTests extends RestTest
public void collaboratorIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingResource(document).addComments(comment1, comment2)
.onCoreAPI().usingResource(document).addComments(comment1, comment2)
.assertThat().paginationExist().and().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
@@ -106,7 +103,7 @@ public class AddCommentsSanityTests extends RestTest
public void consumerIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingResource(document).addComments(comment1, comment2);
.onCoreAPI().usingResource(document).addComments(comment1, comment2);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -117,7 +114,7 @@ public class AddCommentsSanityTests extends RestTest
public void unauthenticatedUserIsNotAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"))
.usingResource(document).addComments(comment1, comment2);
.onCoreAPI().usingResource(document).addComments(comment1, comment2);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -4,9 +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.requests.Node;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.ErrorModel;
import org.alfresco.utility.model.FileModel;
@@ -15,7 +13,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
@@ -24,13 +21,6 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public class DeleteCommentsSanityTests extends RestTest
{
@Autowired
Node commentsAPI;
@Autowired
DataUser dataUser;
private UserModel adminUserModel;
private FileModel document;
@@ -52,7 +42,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void addCommentToDocument() throws Exception
{
restClient.authenticateUser(adminUserModel);
comment = restClient.usingResource(document).addComment("This is a new comment");
comment = restClient.onCoreAPI().usingResource(document).addComment("This is a new comment");
}
@TestRail(section = { TestGroup.REST_API,
@@ -60,7 +50,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void adminIsAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
restClient.usingResource(document).deleteComment(comment);
restClient.onCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@@ -69,7 +59,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void managerIsAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingResource(document).deleteComment(comment);
restClient.onCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@@ -78,7 +68,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void collaboratorIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingResource(document).deleteComment(comment);
restClient.onCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -88,7 +78,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void contributorIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingResource(document).deleteComment(comment);
restClient.onCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -98,7 +88,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void consumerIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingResource(document).deleteComment(comment);
restClient.onCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -109,7 +99,7 @@ public class DeleteCommentsSanityTests extends RestTest
{
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
restClient.authenticateUser(nonexistentModel);
restClient.usingResource(document).deleteComment(comment);
restClient.onCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -3,9 +3,7 @@ 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.requests.Node;
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.SiteModel;
@@ -14,7 +12,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -22,13 +19,7 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public class GetCommentsSanityTests extends RestTest
{
@Autowired
Node commentsAPI;
@Autowired
DataUser dataUser;
private UserModel adminUserModel;
private UserModel adminUserModel;
private FileModel document;
private SiteModel siteModel;
@@ -44,7 +35,7 @@ public class GetCommentsSanityTests extends RestTest
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
content = "This is a new comment";
restClient.usingResource(document).addComment(content);
restClient.onCoreAPI().usingResource(document).addComment(content);
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
}
@@ -54,7 +45,7 @@ public class GetCommentsSanityTests extends RestTest
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
restClient.usingResource(document).getNodeComments();
restClient.onCoreAPI().usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -63,7 +54,7 @@ public class GetCommentsSanityTests extends RestTest
public void managerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingResource(document).getNodeComments()
restClient.onCoreAPI().usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -74,7 +65,7 @@ public class GetCommentsSanityTests extends RestTest
public void contributorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingResource(document).getNodeComments()
restClient.onCoreAPI().usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -85,7 +76,7 @@ public class GetCommentsSanityTests extends RestTest
public void collaboratorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingResource(document).getNodeComments()
restClient.onCoreAPI().usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -95,7 +86,7 @@ public class GetCommentsSanityTests extends RestTest
public void consumerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingResource(document).getNodeComments()
restClient.onCoreAPI().usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -107,7 +98,7 @@ public class GetCommentsSanityTests extends RestTest
{
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
restClient.authenticateUser(nonexistentModel);
restClient.usingResource(document).getNodeComments();
restClient.onCoreAPI().usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -118,10 +109,10 @@ public class GetCommentsSanityTests extends RestTest
userModel = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
restClient.authenticateUser(userModel);
String contentManager = "This is a new comment added by " + userModel.getUsername();
restClient.usingResource(document).addComment(contentManager);
restClient.onCoreAPI().usingResource(document).addComment(contentManager);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingResource(document).getNodeComments()
restClient.onCoreAPI().usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", contentManager);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -134,10 +125,10 @@ public class GetCommentsSanityTests extends RestTest
userModel = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
restClient.authenticateUser(userModel);
String contentCollaborator = "This is a new comment added by " + userModel.getUsername();
restClient.usingResource(document).addComment(contentCollaborator);
restClient.onCoreAPI().usingResource(document).addComment(contentCollaborator);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(adminUserModel);
restClient.usingResource(document).getNodeComments()
restClient.onCoreAPI().usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", contentCollaborator);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -4,9 +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.requests.Node;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.ErrorModel;
import org.alfresco.utility.model.FileModel;
@@ -17,7 +15,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -25,12 +22,6 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public class UpdateCommentsSanityTests extends RestTest
{
@Autowired
Node commentsAPI;
@Autowired
DataUser dataUser;
private UserModel adminUserModel;
private FileModel document;
private SiteModel siteModel;
@@ -45,7 +36,7 @@ public class UpdateCommentsSanityTests extends RestTest
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
commentModel = restClient.usingResource(document).addComment("This is a new comment");
commentModel = restClient.onCoreAPI().usingResource(document).addComment("This is a new comment");
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
}
@@ -56,7 +47,7 @@ public class UpdateCommentsSanityTests extends RestTest
{
restClient.authenticateUser(adminUserModel);
String updatedContent = "This is the updated comment with admin user";
restClient.usingResource(document).updateComment(commentModel, updatedContent)
restClient.onCoreAPI().usingResource(document).updateComment(commentModel, updatedContent)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(updatedContent);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -67,7 +58,7 @@ public class UpdateCommentsSanityTests extends RestTest
public void managerIsAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Manager user")
restClient.onCoreAPI().usingResource(document).updateComment(commentModel, "This is the updated comment with Manager user")
.and().field("content").is("This is the updated comment with Manager user")
.and().field("canEdit").is(true)
.and().field("canDelete").is(true);
@@ -80,7 +71,7 @@ public class UpdateCommentsSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
String updatedContent = "This is the updated comment with Contributor user";
restClient.usingResource(document).updateComment(commentModel, updatedContent);
restClient.onCoreAPI().usingResource(document).updateComment(commentModel, updatedContent);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -90,7 +81,7 @@ public class UpdateCommentsSanityTests extends RestTest
public void consumerIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Consumer user");
restClient.onCoreAPI().usingResource(document).updateComment(commentModel, "This is the updated comment with Consumer user");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -101,9 +92,8 @@ public class UpdateCommentsSanityTests extends RestTest
public void collaboratorIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
restClient.onCoreAPI().usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API,
@@ -113,7 +103,7 @@ public class UpdateCommentsSanityTests extends RestTest
{
UserModel incorrectUserModel = new UserModel("userName", "password");
restClient.authenticateUser(incorrectUserModel)
.usingResource(document).getNodeComments();
.onCoreAPI().usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -124,7 +114,7 @@ public class UpdateCommentsSanityTests extends RestTest
FolderModel content = FolderModel.getRandomFolderModel();
content.setNodeRef("node ref that does not exist");
restClient.usingResource(content).updateComment(commentModel, "This is the updated comment.");
restClient.onCoreAPI().usingResource(content).updateComment(commentModel, "This is the updated comment.");
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary("node ref that does not exist was not found");
}
@@ -137,7 +127,7 @@ public class UpdateCommentsSanityTests extends RestTest
RestCommentModel comment = new RestCommentModel();
String id = "comment id that does not exist";
comment.setId(id);
restClient.usingResource(document).updateComment(comment, "This is the updated comment.");
restClient.onCoreAPI().usingResource(document).updateComment(comment, "This is the updated comment.");
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, id));
}
@@ -41,10 +41,10 @@ public class RestDemoTests extends RestTest
@Test
public void adminRetrievesCorrectSiteDetails() throws JsonToModelConversionException, Exception
{
restClient.getSites().assertThat()
restClient.onCoreAPI().getSites().assertThat()
.entriesListContains("id", siteModel.getId());
restClient.usingSite(siteModel).getSite()
restClient.onCoreAPI().usingSite(siteModel).getSite()
.assertThat().field("id").isNotNull()
.assertThat().field("description").is(siteModel.getDescription())
.assertThat().field("title").is(siteModel.getTitle())
@@ -65,8 +65,8 @@ public class RestDemoTests extends RestTest
.usingResource(FolderModel.getSharedFolderModel())
.createContent(DocumentType.TEXT_PLAIN);
// add new comment
restClient.usingResource(fileModel).addComment("This is a new comment");
restClient.usingResource(fileModel).getNodeComments()
restClient.onCoreAPI().usingResource(fileModel).addComment("This is a new comment");
restClient.onCoreAPI().usingResource(fileModel).getNodeComments()
.assertThat().entriesListIsNotEmpty().and()
.entriesListContains("content", "This is a new comment");
}
@@ -87,20 +87,20 @@ public class RestDemoTests extends RestTest
testUser.setUserRole(UserRole.SiteConsumer);
// add user as Consumer to site
restClient.usingSite(siteModel).addPerson(testUser);
restClient.usingSite(siteModel).getSiteMembers().assertThat().entriesListContains("id", testUser.getUsername())
restClient.onCoreAPI().usingSite(siteModel).addPerson(testUser);
restClient.onCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListContains("id", testUser.getUsername())
.when().getSiteMember(testUser.getUsername())
.assertSiteMemberHasRole(Role.SiteConsumer);
// update site member to Manager
testUser.setUserRole(UserRole.SiteCollaborator);
restClient.usingSite(siteModel).updateSiteMember(testUser);
restClient.usingSite(siteModel).getSiteMembers().and()
restClient.onCoreAPI().usingSite(siteModel).updateSiteMember(testUser);
restClient.onCoreAPI().usingSite(siteModel).getSiteMembers().and()
.entriesListContains("id", testUser.getUsername())
.when().getSiteMember(testUser.getUsername())
.assertSiteMemberHasRole(Role.SiteCollaborator);
restClient.usingSite(siteModel).deleteSiteMember(testUser);
restClient.onCoreAPI().usingSite(siteModel).deleteSiteMember(testUser);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
}
@@ -36,7 +36,7 @@ public class SampleCommentsTests extends RestTest
description= "Verify admin user adds comments with Rest API and status code is 200")
public void admiShouldAddComment() throws JsonToModelConversionException, Exception
{
restClient.usingResource(document).addComment("This is a new comment");
restClient.onCoreAPI().usingResource(document).addComment("This is a new comment");
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -44,7 +44,7 @@ public class SampleCommentsTests extends RestTest
description= "Verify admin user gets comments with Rest API and status code is 200")
public void admiShouldRetrieveComments() throws Exception
{
restClient.usingResource(document).getNodeComments();
restClient.onCoreAPI().usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -52,9 +52,9 @@ public class SampleCommentsTests extends RestTest
description= "Verify admin user updates comments with Rest API")
public void adminShouldUpdateComment() throws JsonToModelConversionException, Exception
{
RestCommentModel commentModel = restClient.usingResource(document).addComment("This is a new comment");
RestCommentModel commentModel = restClient.onCoreAPI().usingResource(document).addComment("This is a new comment");
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user")
restClient.onCoreAPI().usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user")
.assertThat().field("content").is("This is the updated comment with Collaborator user");
}
@@ -28,7 +28,7 @@ public class SamplePeopleTests extends RestTest
description = "Verify admin user gets person with Rest API and response is not empty")
public void adminShouldRetrievePerson() throws Exception
{
restClient.usingUser(userModel).getPerson().assertThat().field("id").isNotEmpty();
restClient.onCoreAPI().usingUser(userModel).getPerson().assertThat().field("id").isNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -30,7 +30,7 @@ public class SampleSitesTests extends RestTest
description = "Verify admin user gets site details with Rest API and response is not empty")
public void adminShouldGetSiteDetails() throws JsonToModelConversionException, Exception
{
restClient.usingSite(siteModel).getSite()
restClient.onCoreAPI().usingSite(siteModel).getSite()
.assertThat().field("id").isNotNull();
}
@@ -38,7 +38,7 @@ public class SampleSitesTests extends RestTest
description = "Verify admin user gets site information and gets status code OK (200)")
public void adminShouldGetSites() throws JsonToModelConversionException, Exception
{
restClient.usingSite(siteModel).getSite();
restClient.onCoreAPI().usingSite(siteModel).getSite();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -46,7 +46,7 @@ public class SampleSitesTests extends RestTest
description = "Verify admin user gets sites with Rest API and the response is not empty")
public void adminShouldAccessSites() throws JsonToModelConversionException, Exception
{
restClient.getSites().assertThat().entriesListIsNotEmpty();
restClient.onCoreAPI().getSites().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -54,7 +54,7 @@ public class SampleSitesTests extends RestTest
description = "Verify admin user gets sites with Rest API and status code is 200")
public void adminShouldAccessResponsePagination() throws JsonToModelConversionException, Exception
{
restClient.getSites().assertThat().paginationExist();
restClient.onCoreAPI().getSites().assertThat().paginationExist();
}
@TestRail(section={"demo", "sample-section"}, executionType= ExecutionType.SANITY,
@@ -63,7 +63,7 @@ public class SampleSitesTests extends RestTest
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.usingSite(siteModel).addPerson(testUser);
restClient.onCoreAPI().usingSite(siteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -71,14 +71,14 @@ public class SampleSitesTests extends RestTest
description = "Verify that site exists from get all sites request")
public void adminShouldGetSiteFromSitesList() throws JsonToModelConversionException, Exception
{
restClient.getSites().assertThat().entriesListContains("id", siteModel.getId());
restClient.onCoreAPI().getSites().assertThat().entriesListContains("id", siteModel.getId());
}
@TestRail(section={"demo", "sample-section"}, executionType= ExecutionType.SANITY,
description = "Verify site details: response not empty, description, title, visibility")
public void adminShouldAccessSiteDetails() throws JsonToModelConversionException, Exception
{
restClient.usingSite(siteModel).getSite()
restClient.onCoreAPI().usingSite(siteModel).getSite()
.assertThat().field("id").isNotNull()
.and().field("description").is(siteModel.getDescription())
.and().field("title").is(siteModel.getTitle())
@@ -31,72 +31,78 @@ public class AddFavoritesSanityTests extends RestTest
{
adminUserModel = dataUser.getAdminUser();
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
siteModel.setGuid(restClient.authenticateUser(adminUserModel).usingSite(siteModel).getSite().getGuid());
siteModel.setGuid(restClient.authenticateUser(adminUserModel).onCoreAPI().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 add site to favorites with Rest API and status code is 201")
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES },
executionType = ExecutionType.SANITY,
description = "Verify Admin user add site to favorites with Rest API and status code is 201")
public void adminIsAbleToAddToFavorites() throws Exception
{
restClient.usingAuthUser()
restClient.onCoreAPI().usingAuthUser()
.addSiteToFavorites(siteModel)
.assertThat().field("targetGuid").is(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Manager user add site to favorites with Rest API and status code is 201")
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES },
executionType = ExecutionType.SANITY,
description = "Verify Manager user add site to favorites with Rest API and status code is 201")
public void managerIsAbleToAddToFavorites() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.usingAuthUser()
.onCoreAPI().usingAuthUser()
.addSiteToFavorites(siteModel)
.assertThat().field("targetGuid").is(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Collaborator user add site to favorites with Rest API and status code is 201")
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES },
executionType = ExecutionType.SANITY,
description = "Verify Collaborator user add site to favorites with Rest API and status code is 201")
public void collaboratorIsAbleToAddToFavorites() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingAuthUser()
.onCoreAPI().usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Contributor user add site to favorites with Rest API and status code is 201")
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES },
executionType = ExecutionType.SANITY,
description = "Verify Contributor user add site to favorites with Rest API and status code is 201")
public void contributorIsAbleToAddToFavorites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.usingAuthUser()
.onCoreAPI().usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Consumer user add site to favorites with Rest API and status code is 201")
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES },
executionType = ExecutionType.SANITY,
description = "Verify Consumer user add site to favorites with Rest API and status code is 201")
public void consumerIsAbleToAddToFavorites() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingAuthUser()
.onCoreAPI().usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Manager user gets status code 401 if authentication call fails")
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES },
executionType = ExecutionType.SANITY,
description = "Verify Manager user gets status code 401 if authentication call fails")
@Bug(id="MNT-16904")
public void managerIsNotAbleToAddToFavoritesIfAuthenticationFails() throws Exception
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager)
.usingAuthUser()
.onCoreAPI().usingAuthUser()
.addSiteToFavorites(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -28,7 +28,7 @@ public class DeleteFavoritesSanityTests extends RestTest
adminUserModel = dataUser.getAdminUser();
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
siteModel.setGuid(restClient.authenticateUser(adminUserModel).usingSite(siteModel).getSite().getGuid());
siteModel.setGuid(restClient.authenticateUser(adminUserModel).onCoreAPI().usingSite(siteModel).getSite().getGuid());
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
UserRole.SiteContributor);
@@ -38,12 +38,12 @@ public class DeleteFavoritesSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Admin user deletes site from favorites with Rest API and status code is 204")
public void adminIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
{
restClient.usingUser(adminUserModel)
restClient.onCoreAPI().usingUser(adminUserModel)
.addSiteToFavorites(siteModel).assertThat().field("targetGuid").is(siteModel.getGuid());
restClient.usingAuthUser().deleteSiteFromFavorites(siteModel)
restClient.onCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
}
@TestRail(section = { TestGroup.REST_API,
@@ -52,13 +52,14 @@ public class DeleteFavoritesSanityTests extends RestTest
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
restClient.authenticateUser(siteManager)
.onCoreAPI()
.usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.usingAuthUser()
restClient.onCoreAPI().usingAuthUser()
.deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
}
@TestRail(section = { TestGroup.REST_API,
@@ -67,12 +68,13 @@ public class DeleteFavoritesSanityTests extends RestTest
{
UserModel siteCollaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
restClient.authenticateUser(siteCollaborator)
.onCoreAPI()
.usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.usingAuthUser().deleteSiteFromFavorites(siteModel)
restClient.onCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
}
@TestRail(section = { TestGroup.REST_API,
@@ -80,13 +82,14 @@ public class DeleteFavoritesSanityTests extends RestTest
public void contributorIsAbleToDeleteFavorites() throws JsonToModelConversionException, Exception
{
UserModel siteContributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
restClient.authenticateUser(siteContributor)
restClient.authenticateUser(siteContributor)
.onCoreAPI()
.usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.usingAuthUser().deleteSiteFromFavorites(siteModel)
restClient.onCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
}
@TestRail(section = { TestGroup.REST_API,
@@ -95,11 +98,12 @@ public class DeleteFavoritesSanityTests extends RestTest
{
UserModel siteConsumer = usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer);
restClient.authenticateUser(siteConsumer)
.onCoreAPI()
.usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.onCoreAPI().usingAuthUser().deleteSiteFromFavorites(siteModel).assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("targetGuid", siteModel.getGuid());
}
@TestRail(section = { TestGroup.REST_API,
@@ -109,9 +113,11 @@ public class DeleteFavoritesSanityTests extends RestTest
{
UserModel siteCollaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
restClient.authenticateUser(siteCollaborator)
.onCoreAPI()
.usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingAuthUser()
.deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
@@ -122,11 +128,13 @@ public class DeleteFavoritesSanityTests extends RestTest
public void userIsNotAbleToDeleteFavoritesOfAdminUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel)
.onCoreAPI()
.usingAuthUser()
.addSiteToFavorites(siteModel)
.and().field("targetGuid").is(siteModel.getGuid());
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingAuthUser()
.deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
@@ -137,10 +145,12 @@ public class DeleteFavoritesSanityTests extends RestTest
public void adminIsNotAbleToDeleteFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingAuthUser()
.addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.authenticateUser(adminUserModel)
.onCoreAPI()
.usingAuthUser()
.deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
@@ -153,6 +163,7 @@ public class DeleteFavoritesSanityTests extends RestTest
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager)
.onCoreAPI()
.usingAuthUser()
.deleteSiteFromFavorites(siteModel)
.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
@@ -37,7 +37,7 @@ public class GetFavoriteSanityTests extends RestTest
folderModel = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
fileModel = dataContent.usingUser(adminUserModel).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
siteModel.setGuid(restClient.authenticateUser(adminUserModel).usingSite(siteModel).getSite().getGuid());
siteModel.setGuid(restClient.authenticateUser(adminUserModel).onCoreAPI().usingSite(siteModel).getSite().getGuid());
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
UserRole.SiteContributor);
@@ -47,8 +47,8 @@ public class GetFavoriteSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Admin user gets favorite site with Rest API and status code is 200")
public void adminIsAbleToRetrieveFavoritesSite() throws JsonToModelConversionException, Exception
{
restClient.usingUser(adminUserModel).addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.usingUser(adminUserModel).getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.onCoreAPI().usingUser(adminUserModel).addSiteToFavorites(siteModel).and().field("targetGuid").is(siteModel.getGuid());
restClient.onCoreAPI().usingUser(adminUserModel).getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -56,8 +56,8 @@ public class GetFavoriteSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Admin user gets favorite folder with Rest API and status code is 200")
public void adminIsAbleToRetrieveFavoritesFolder() throws JsonToModelConversionException, Exception
{
restClient.usingUser(adminUserModel).addFolderToFavorites(folderModel).and().field("targetGuid").is(folderModel.getNodeRef());
restClient.usingUser(adminUserModel).getFavorites().and().entriesListContains("targetGuid", folderModel.getNodeRef());
restClient.onCoreAPI().usingUser(adminUserModel).addFolderToFavorites(folderModel).and().field("targetGuid").is(folderModel.getNodeRef());
restClient.onCoreAPI().usingUser(adminUserModel).getFavorites().and().entriesListContains("targetGuid", folderModel.getNodeRef());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -65,8 +65,8 @@ public class GetFavoriteSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Admin user gets favorite file with Rest API and status code is 200")
public void adminIsAbleToRetrieveFavoritesFile() throws JsonToModelConversionException, Exception
{
restClient.usingUser(adminUserModel).addFileToFavorites(fileModel);
restClient.usingUser(adminUserModel).getFavorites().and().entriesListContains("targetGuid", fileModel.getNodeRef());
restClient.onCoreAPI().usingUser(adminUserModel).addFileToFavorites(fileModel);
restClient.onCoreAPI().usingUser(adminUserModel).getFavorites().and().entriesListContains("targetGuid", fileModel.getNodeRef());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -75,8 +75,8 @@ public class GetFavoriteSanityTests extends RestTest
public void managerIsAbleToRetrieveFavorite() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingAuthUser().addSiteToFavorites(siteModel);
restClient.usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
restClient.onCoreAPI().usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -84,9 +84,10 @@ public class GetFavoriteSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Collaborator user gets favorite site with Rest API and status code is 200")
public void collaboratorIsAbleToRetrieveFavorites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingAuthUser().addSiteToFavorites(siteModel);
restClient.usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingAuthUser().addSiteToFavorites(siteModel);
restClient.onCoreAPI().usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -95,8 +96,8 @@ public class GetFavoriteSanityTests extends RestTest
public void contributorIsAbleToRetrieveFavorite() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingAuthUser().addSiteToFavorites(siteModel);
restClient.usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
restClient.onCoreAPI().usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -105,8 +106,8 @@ public class GetFavoriteSanityTests extends RestTest
public void consumerIsAbleToRetrieveFavorites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingAuthUser().addSiteToFavorites(siteModel);
restClient.usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
restClient.onCoreAPI().usingAuthUser().getFavoriteSites().and().entriesListContains("guid",siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -115,7 +116,7 @@ public class GetFavoriteSanityTests extends RestTest
public void userIsNotAbleToRetrieveFavoriteSiteOfAnotherUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
restClient.onCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.getFavorite(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
@@ -127,6 +128,7 @@ public class GetFavoriteSanityTests extends RestTest
public void userIsNotAbleToRetrieveFavoritesOfAdminUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingUser(adminUserModel)
.getFavorite(siteModel.getGuid());
@@ -139,6 +141,7 @@ public class GetFavoriteSanityTests extends RestTest
public void adminIsNotAbleToRetrieveFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel)
.onCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.getFavorite(siteModel.getGuid());
@@ -154,6 +157,7 @@ public class GetFavoriteSanityTests extends RestTest
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager)
.onCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.getFavorite(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
@@ -43,8 +43,8 @@ public class GetFavoritesSanityTests extends RestTest
secondFileModel = dataContent.usingUser(adminUserModel).usingResource(firstFolderModel).createContent(DocumentType.TEXT_PLAIN);
firstSiteModel.setGuid(restClient.authenticateUser(adminUserModel).usingSite(firstSiteModel).getSite().getGuid());
secondSiteModel.setGuid(restClient.authenticateUser(adminUserModel).usingSite(secondSiteModel).getSite().getGuid());
firstSiteModel.setGuid(restClient.authenticateUser(adminUserModel).onCoreAPI().usingSite(firstSiteModel).getSite().getGuidWithoutVersion());
secondSiteModel.setGuid(restClient.authenticateUser(adminUserModel).onCoreAPI().usingSite(secondSiteModel).getSite().getGuidWithoutVersion());
usersWithRoles = dataUser.addUsersWithRolesToSite(firstSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
UserRole.SiteContributor);
@@ -54,11 +54,12 @@ public class GetFavoritesSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Admin user gets favorites sites with Rest API and status code is 200")
public void adminIsAbleToRetrieveFavoritesSites() throws JsonToModelConversionException, Exception
{
restClient.usingUser(adminUserModel).addSiteToFavorites(firstSiteModel);
restClient.usingUser(adminUserModel).addSiteToFavorites(secondSiteModel);
restClient.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.and().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.onCoreAPI().usingUser(adminUserModel).addSiteToFavorites(firstSiteModel);
restClient.onCoreAPI().usingUser(adminUserModel).addSiteToFavorites(secondSiteModel);
restClient.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.and().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -66,11 +67,12 @@ public class GetFavoritesSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Admin user gets favorites folders with Rest API and status code is 200")
public void adminIsAbleToRetrieveFavoritesFolders() throws JsonToModelConversionException, Exception
{
restClient.usingUser(adminUserModel).addFolderToFavorites(firstFolderModel);
restClient.usingUser(adminUserModel).addFolderToFavorites(secondFolderModel);
restClient.usingAuthUser().where().targetFolderExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstFolderModel.getNodeRef())
.and().entriesListContains("targetGuid", secondFolderModel.getNodeRef());
restClient.onCoreAPI().usingUser(adminUserModel).addFolderToFavorites(firstFolderModel);
restClient.onCoreAPI().usingUser(adminUserModel).addFolderToFavorites(secondFolderModel);
restClient.onCoreAPI()
.usingAuthUser().where().targetFolderExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstFolderModel.getNodeRef())
.and().entriesListContains("targetGuid", secondFolderModel.getNodeRef());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -78,11 +80,12 @@ public class GetFavoritesSanityTests extends RestTest
TestGroup.FAVORITES }, executionType = ExecutionType.SANITY, description = "Verify Admin user gets favorites files with Rest API and status code is 200")
public void adminIsAbleToRetrieveFavoritesFiles() throws JsonToModelConversionException, Exception
{
restClient.usingUser(adminUserModel).addFileToFavorites(firstFileModel);
restClient.usingUser(adminUserModel).addFileToFavorites(secondFileModel);
restClient.usingAuthUser().where().targetFileExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstFileModel.getNodeRef())
.and().entriesListContains("targetGuid", secondFileModel.getNodeRef());
restClient.onCoreAPI().usingUser(adminUserModel).addFileToFavorites(firstFileModel);
restClient.onCoreAPI().usingUser(adminUserModel).addFileToFavorites(secondFileModel);
restClient.onCoreAPI()
.usingAuthUser().where().targetFileExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstFileModel.getNodeRefWithoutVersion())
.and().entriesListContains("targetGuid", secondFileModel.getNodeRefWithoutVersion());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -91,11 +94,13 @@ public class GetFavoritesSanityTests extends RestTest
public void managerIsAbleToRetrieveFavorites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingAuthUser().addSiteToFavorites(firstSiteModel);
restClient.usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.assertThat().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.onCoreAPI()
.usingAuthUser().addSiteToFavorites(firstSiteModel);
restClient.onCoreAPI().usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.assertThat().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -104,11 +109,14 @@ public class GetFavoritesSanityTests extends RestTest
public void collaboratorIsAbleToRetrieveFavorites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingAuthUser().addSiteToFavorites(firstSiteModel);
restClient.usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.and().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.onCoreAPI()
.usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.and().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -117,11 +125,13 @@ public class GetFavoritesSanityTests extends RestTest
public void contributorIsAbleToRetrieveFavorites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.onCoreAPI()
.usingAuthUser().addSiteToFavorites(firstSiteModel);
restClient.usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid()).and()
.entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid()).and()
.entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -130,11 +140,13 @@ public class GetFavoritesSanityTests extends RestTest
public void consumerIsAbleToRetrieveFavorites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingAuthUser().addSiteToFavorites(firstSiteModel);
restClient.usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.assertThat().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.onCoreAPI().usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites()
.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid())
.assertThat().entriesListContains("targetGuid", secondSiteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -143,6 +155,7 @@ public class GetFavoritesSanityTests extends RestTest
public void userIsNotAbleToRetrieveFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()));
@@ -153,9 +166,10 @@ public class GetFavoritesSanityTests extends RestTest
public void userIsNotAbleToRetrieveFavoritesOfAdminUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, adminUserModel.getUsername()));
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, adminUserModel.getUsername()));
}
@TestRail(section = { TestGroup.REST_API,
@@ -163,9 +177,10 @@ public class GetFavoritesSanityTests extends RestTest
public void adminIsNotAbleToRetrieveFavoritesOfAnotherUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel)
.onCoreAPI()
.usingAuthUser().where().targetSiteExist().getFavorites();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()));
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()));
}
@TestRail(section = { TestGroup.REST_API,
@@ -176,8 +191,9 @@ public class GetFavoritesSanityTests extends RestTest
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager)
.onCoreAPI()
.usingAuthUser().addSiteToFavorites(firstSiteModel);
restClient.usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.onCoreAPI().usingAuthUser().addSiteToFavorites(secondSiteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -10,7 +10,6 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
public class RestGetNetworkForPersonSanityTests extends RestTest
{
private UserModel adminUserModel;
@@ -29,47 +28,51 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
@Bug(id = "MNT-16904")
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
{
UserModel tenantUser = new UserModel("nonexisting", "password");
tenantUser.setDomain(adminTenantUser.getDomain());
restClient.authenticateUser(tenantUser);
restClient.usingUser(tenantUser).getNetwork(adminTenantUser);
restClient.onCoreAPI().usingUser(tenantUser).getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void adminTenantChecksIfNetworkIsPresent() throws Exception
{
restClient.authenticateUser(adminTenantUser);
restClient.usingUser(adminTenantUser).getNetwork();
restClient.onCoreAPI().usingUser(adminTenantUser).getNetwork();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
{
restClient.authenticateUser(tenantUser);
restClient.usingUser(tenantUser).getNetwork(adminTenantUser);
restClient.onCoreAPI().usingUser(tenantUser).getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
{
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
restClient.usingTenant().createTenant(secondAdminTenantUser);
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
restClient.authenticateUser(adminTenantUser);
restClient.usingUser(adminTenantUser).getNetwork(secondTenantUser);
restClient.onCoreAPI().usingUser(adminTenantUser).getNetwork(secondTenantUser);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
}
@@ -46,7 +46,7 @@ public class RestGetNetworkTest extends RestTest
UserModel tenantUser = new UserModel("nonexisting", "password");
tenantUser.setDomain(adminTenantUser.getDomain());
restClient.authenticateUser(tenantUser);
restClient.usingNetworks().getNetwork(adminTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -56,7 +56,7 @@ public class RestGetNetworkTest extends RestTest
public void adminTenantChecksIfNetworkIsPresent() throws Exception
{
restClient.authenticateUser(adminTenantUser);
restClient.usingNetworks().getNetwork();
restClient.onCoreAPI().usingNetworks().getNetwork();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -65,7 +65,7 @@ public class RestGetNetworkTest extends RestTest
public void adminTenantChecksNetworkParamsAreCorrect() throws Exception
{
restClient.authenticateUser(adminTenantUser);
restClient.usingNetworks().getNetwork().assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
restClient.onCoreAPI().usingNetworks().getNetwork().assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
}
@TestRail(section = { TestGroup.REST_API,
@@ -73,7 +73,7 @@ public class RestGetNetworkTest extends RestTest
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
{
restClient.authenticateUser(adminTenantUser);
restClient.usingNetworks().getNetwork(UserModel.getRandomTenantUser());
restClient.onCoreAPI().usingNetworks().getNetwork(UserModel.getRandomTenantUser());
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
@@ -82,7 +82,7 @@ public class RestGetNetworkTest extends RestTest
public void adminTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
{
restClient.authenticateUser(adminTenantUser);
restClient.usingNetworks().getNetwork(adminAnotherTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminAnotherTenantUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
}
@@ -90,7 +90,7 @@ public class RestGetNetworkTest extends RestTest
public void userTenantChecksIfNetworkIsPresent() throws Exception
{
restClient.authenticateUser(tenantUser);
restClient.usingNetworks().getNetwork(adminTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -99,7 +99,7 @@ public class RestGetNetworkTest extends RestTest
public void userTenantChecksNetworkParamsAreCorrect() throws Exception
{
restClient.authenticateUser(tenantUser);
restClient.usingNetworks().getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
restClient.onCoreAPI().usingNetworks().getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
}
@TestRail(section = { TestGroup.REST_API,
@@ -107,7 +107,7 @@ public class RestGetNetworkTest extends RestTest
public void userTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
{
restClient.authenticateUser(tenantUser);
restClient.usingNetworks().getNetwork(UserModel.getRandomTenantUser());
restClient.onCoreAPI().usingNetworks().getNetwork(UserModel.getRandomTenantUser());
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
@@ -117,7 +117,7 @@ public class RestGetNetworkTest extends RestTest
public void userTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
{
restClient.authenticateUser(tenantUser);
restClient.usingNetworks().getNetwork(adminAnotherTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminAnotherTenantUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
}
@@ -130,7 +130,7 @@ public class RestGetNetworkTest extends RestTest
dataUser.usingUser(adminTenantUser).addUserToSite(managerTenantUser, site, UserRole.SiteManager);
restClient.authenticateUser(managerTenantUser);
restClient.usingNetworks().getNetwork(adminTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -143,7 +143,7 @@ public class RestGetNetworkTest extends RestTest
dataUser.usingUser(adminTenantUser).addUserToSite(collaboratorTenantUser, site, UserRole.SiteCollaborator);
restClient.authenticateUser(collaboratorTenantUser);
restClient.usingNetworks().getNetwork(adminTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -156,7 +156,7 @@ public class RestGetNetworkTest extends RestTest
dataUser.usingUser(adminTenantUser).addUserToSite(consumerTenantUser, site, UserRole.SiteConsumer);
restClient.authenticateUser(consumerTenantUser);
restClient.usingNetworks().getNetwork(adminTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -169,7 +169,7 @@ public class RestGetNetworkTest extends RestTest
dataUser.usingUser(adminTenantUser).addUserToSite(contributorTenantUser, site, UserRole.SiteContributor);
restClient.authenticateUser(contributorTenantUser);
restClient.usingNetworks().getNetwork(adminTenantUser);
restClient.onCoreAPI().usingNetworks().getNetwork(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
}
@@ -10,7 +10,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
public class RestGetNetworksForPersonSanityTests extends RestTest
{
private UserModel adminUserModel;
@@ -29,47 +29,51 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
@Bug(id = "MNT-16904")
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
{
UserModel tenantUser = new UserModel("nonexisting", "password");
tenantUser.setDomain(adminTenantUser.getDomain());
restClient.authenticateUser(tenantUser);
restClient.usingUser(tenantUser).getNetworks(adminTenantUser);
restClient.onCoreAPI().usingUser(tenantUser).getNetworks(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void adminTenantChecksIfNetworkIsPresent() throws Exception
{
restClient.authenticateUser(adminTenantUser);
restClient.usingUser(adminTenantUser).getNetworks();
restClient.onCoreAPI().usingUser(adminTenantUser).getNetworks();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
{
restClient.authenticateUser(tenantUser);
restClient.usingUser(tenantUser).getNetworks(adminTenantUser);
restClient.onCoreAPI().usingUser(tenantUser).getNetworks(adminTenantUser);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
@Test(groups = TestGroup.COMMENTS)
@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")
@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")
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
{
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
restClient.usingTenant().createTenant(secondAdminTenantUser);
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
restClient.authenticateUser(secondAdminTenantUser);
restClient.usingUser(secondAdminTenantUser).getNetworks(secondTenantUser);
restClient.onCoreAPI().usingUser(secondAdminTenantUser).getNetworks(secondTenantUser);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
}
@@ -33,12 +33,13 @@ public class AddFavoriteSiteSanityTests extends RestTest
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingUser(managerUser)
.addFavoriteSite(siteModel)
.assertThat().field("id").is(siteModel.getId());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.usingUser(managerUser).addFavoriteSite(siteModel);
restClient.onCoreAPI().usingUser(managerUser).addFavoriteSite(siteModel);
restClient.assertStatusCodeIs(HttpStatus.CONFLICT);
restClient.assertLastError().containsSummary(String.format("%s is already a favourite site", siteModel.getId()));
}
@@ -50,6 +51,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
dataUser.usingUser(userModel).addUserToSite(collaboratorUser, siteModel, UserRole.SiteCollaborator);
restClient.authenticateUser(collaboratorUser)
.onCoreAPI()
.usingAuthUser()
.addFavoriteSite(siteModel)
.assertThat().field("id").is(siteModel.getId());
@@ -63,6 +65,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
restClient.authenticateUser(contributorUser)
.onCoreAPI()
.usingAuthUser()
.addFavoriteSite(siteModel)
.assertThat().field("id").is(siteModel.getId());
@@ -76,6 +79,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(consumerUser)
.onCoreAPI()
.usingAuthUser()
.addFavoriteSite(siteModel)
.assertThat().field("id").is(siteModel.getId());
@@ -88,6 +92,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
UserModel adminUser = dataUser.getAdminUser();
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingAuthUser()
.addFavoriteSite(siteModel)
.assertThat().field("id").is(siteModel.getId());
@@ -103,6 +108,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser()
.addFavoriteSite(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
@@ -42,12 +42,13 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY, description = "Verify site manager is able to create new site membership request")
executionType = ExecutionType.SANITY, description = "Verify site manager is able to create new site membership request")
@Bug(id="MNT-16557")
public void siteManagerIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingUser(newMember).addSiteMembershipRequest(siteModel)
.assertThat().field("id").isNotEmpty()
.assertThat().field("site").isNotEmpty();
@@ -55,12 +56,14 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY, description = "Verify site collaborator is able to create new site membership request")
executionType = ExecutionType.SANITY,
description = "Verify site collaborator is able to create new site membership request")
@Bug(id = "MNT-16557")
public void siteCollaboatorIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingUser(newMember).addSiteMembershipRequest(siteModel)
.assertThat().field("id").isNotEmpty()
.assertThat().field("site").isNotEmpty();
@@ -68,12 +71,14 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY, description = "Verify site contributor is able to create new site membership request")
executionType = ExecutionType.SANITY,
description = "Verify site contributor is able to create new site membership request")
@Bug(id = "MNT-16557")
public void siteContributorIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.onCoreAPI()
.usingUser(newMember).addSiteMembershipRequest(siteModel)
.assertThat().field("id").isNotEmpty()
.assertThat().field("site").isNotEmpty();
@@ -81,25 +86,29 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY, description = "Verify site consumer is able to create new site membership request")
executionType = ExecutionType.SANITY,
description = "Verify site consumer is able to create new site membership request")
@Bug(id = "MNT-16557")
public void siteConsumerIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingUser(newMember).addSiteMembershipRequest(siteModel)
.assertThat().field("id").isNotEmpty()
.assertThat().field("site").isNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify admin user is able to create new site membership request")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin user is able to create new site membership request")
@Bug(id = "MNT-16557")
public void adminUserIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingUser(newMember).addSiteMembershipRequest(siteModel)
.assertThat().field("id").isNotEmpty()
.assertThat().field("site").isNotEmpty();
@@ -107,12 +116,14 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to create new site membership request")
executionType = ExecutionType.SANITY,
description = "Verify unauthenticated user is not able to create new site membership request")
@Bug(id = "MNT-16557")
public void unauthenticatedUserIsNotAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(new UserModel("random user", "random password"))
.onCoreAPI()
.usingUser(newMember).addSiteMembershipRequest(siteModel)
.assertThat().field("id").isNotEmpty()
.assertThat().field("site").isNotEmpty();
@@ -31,7 +31,9 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
siteModel2 = dataSite.usingUser(userModel).createPublicRandomSite();
}
@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();
@@ -40,12 +42,15 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(managerUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@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();
@@ -54,11 +59,14 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(collaboratorUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(collaboratorUser)
.onCoreAPI()
.usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@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();
@@ -67,11 +75,14 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(contributorUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(contributorUser)
.onCoreAPI()
.usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@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();
@@ -80,11 +91,14 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(consumerUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(consumerUser)
.onCoreAPI()
.usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@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();
@@ -93,11 +107,14 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(anyUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@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)")
@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
{
UserModel userAuth = dataUser.usingAdmin().createRandomTestUser();
@@ -106,12 +123,15 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(anotherUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(userAuth)
.onCoreAPI()
.usingUser(anotherUser).removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@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)")
@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();
@@ -121,6 +141,7 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -3,8 +3,6 @@ package org.alfresco.rest.people;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataSite;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.exception.DataPreparationException;
import org.alfresco.utility.model.ErrorModel;
@@ -14,7 +12,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -22,12 +19,6 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
public class DeleteSiteMemberSanityTests extends RestTest
{
@Autowired
DataUser dataUser;
@Autowired
DataSite dataSite;
private SiteModel siteModel;
private UserModel adminUser;
private ListUserWithRoles usersWithRoles;
@@ -39,96 +30,104 @@ public class DeleteSiteMemberSanityTests extends RestTest
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
UserRole.SiteManager,
UserRole.SiteCollaborator,
UserRole.SiteConsumer,
UserRole.SiteContributor);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site manager is able to delete another member of the site")
executionType = ExecutionType.SANITY,
description = "Verify site manager is able to delete another member of the site")
public void siteManagerCanDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
UserModel newUser = dataUser.createRandomTestUser("testUser");
newUser.setUserRole(UserRole.SiteCollaborator);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingSite(siteModel).addPerson(newUser);
restClient.usingUser(newUser).deleteSiteMember(siteModel);
restClient.onCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin user is able to delete another member of the site")
executionType = ExecutionType.SANITY,
description = "Verify admin user is able to delete another member of the site")
public void adminIsAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
UserModel newUser = dataUser.createRandomTestUser("testUser");
newUser.setUserRole(UserRole.SiteCollaborator);
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingSite(siteModel).addPerson(newUser);
restClient.usingUser(newUser).deleteSiteMember(siteModel);
restClient.onCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site collaborator does not have permission to delete another member of the site")
executionType = ExecutionType.SANITY,
description = "Verify site collaborator does not have permission to delete another member of the site")
@Bug(id="ACE-5444")
public void siteCollaboratorIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
UserModel newUser = dataUser.createRandomTestUser("testUser");
newUser.setUserRole(UserRole.SiteCollaborator);
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingSite(siteModel).addPerson(newUser);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingUser(newUser).deleteSiteMember(siteModel);
restClient.onCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site contributor does not have permission to delete another member of the site")
executionType = ExecutionType.SANITY,
description = "Verify site contributor does not have permission to delete another member of the site")
@Bug(id="ACE-5444")
public void siteContributorIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
UserModel newUser = dataUser.createRandomTestUser("testUser");
newUser.setUserRole(UserRole.SiteCollaborator);
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingSite(siteModel).addPerson(newUser);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingUser(newUser).deleteSiteMember(siteModel);
restClient.onCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site consumer does not have permission to delete another member of the site")
executionType = ExecutionType.SANITY,
description = "Verify site consumer does not have permission to delete another member of the site")
@Bug(id="ACE-5444")
public void siteConsumerIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
UserModel newUser = dataUser.createRandomTestUser("testUser");
newUser.setUserRole(UserRole.SiteCollaborator);
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingSite(siteModel).addPerson(newUser);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingUser(newUser).deleteSiteMember(siteModel);
restClient.onCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify unauthenticated user is not able to delete another member of the site")
executionType = ExecutionType.SANITY,
description = "Verify unauthenticated user is not able to delete another member of the site")
public void unauthenticatedUserIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).deleteSiteMember(siteModel);
restClient.onCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).deleteSiteMember(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -40,111 +40,135 @@ public class DeleteSiteMembershipRequestSanityTests extends RestTest
UserRole.SiteContributor);
}
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify one user is able to delete his one site memebership request")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify one user is able to delete his one site memebership request")
public void userCanDeleteHisOwnSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
{
siteMember = dataUser.createRandomTestUser();
restClient.authenticateUser(siteMember)
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingUser(siteMember).deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@Bug(id="MNT-16916")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify site manager is able to delete site membership request")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site manager is able to delete site membership request")
public void siteManagerCanDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
{
siteMember = dataUser.createRandomTestUser();
restClient.authenticateUser(siteMember)
.onCoreAPI()
.usingUser(siteMember).addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@Bug(id="MNT-16916")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify admin user is able to delete site memebership request")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin user is able to delete site memebership request")
public void adminUserCanDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
{
siteMember = dataUser.createRandomTestUser();
restClient.authenticateUser(siteMember)
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(dataUser.getAdminUser())
.onCoreAPI()
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@Bug(id="MNT-16916")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify collaborator user is not able to delete site memebership request")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify collaborator user is not able to delete site memebership request")
public void collaboratorCannotDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
{
siteMember = dataUser.createRandomTestUser();
restClient.authenticateUser(siteMember)
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@Bug(id="MNT-16916")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify contributor user is not able to delete site memebership request")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify contributor user is not able to delete site memebership request")
public void contributorCannotDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
{
siteMember = dataUser.createRandomTestUser();
restClient.authenticateUser(siteMember)
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.onCoreAPI()
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@Bug(id="MNT-16916")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify consumer user is not able to delete site memebership request")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify consumer user is not able to delete site memebership request")
public void consumerCannotDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
{
siteMember = dataUser.createRandomTestUser();
restClient.authenticateUser(siteMember)
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@Bug(id="MNT-16916")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify random user is not able to delete site memebership request")
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify random user is not able to delete site memebership request")
public void randomUserCanDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
{
restClient.authenticateUser(dataUser.createRandomTestUser())
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.authenticateUser(dataUser.createRandomTestUser())
.onCoreAPI()
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Failed authentication get site member call returns status code 401")
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES },
executionType = ExecutionType.SANITY,
description = "Failed authentication get site member call returns status code 401")
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMmebershipRequest() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(dataUser.createRandomTestUser())
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser)
.onCoreAPI()
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -30,12 +30,14 @@ public class GetFavoriteSiteSanityTests extends RestTest
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
userModel = dataUser.createRandomTestUser();
siteModel1 = dataSite.usingUser(userModel).createPublicRandomSite();
siteModel2 = dataSite.usingUser(userModel).createPublicRandomSite();
userModel = dataUser.createRandomTestUser();
siteModel1 = dataSite.usingUser(userModel).createPublicRandomSite();
siteModel2 = dataSite.usingUser(userModel).createPublicRandomSite();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets its specific favorite site with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify manager user gets its specific favorite site with Rest API and response is successful (200)")
public void managerUserGetsFavoriteSiteWithSuccess() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -44,13 +46,16 @@ public class GetFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(managerUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser().getFavoriteSite(siteModel1)
.assertThat().field("id").is(siteModel1.getId())
.and().field("title").isNotNull();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets its specific favorite site with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify collaborator user gets its specific favorite site with Rest API and response is successful (200)")
public void collaboratorUserGetsFavoriteSiteWithSuccess() throws Exception
{
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -59,13 +64,16 @@ public class GetFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(collaboratorUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(collaboratorUser)
.onCoreAPI()
.usingAuthUser().getFavoriteSite(siteModel1)
.assertThat().field("id").is(siteModel1.getId())
.and().field("title").isNotNull();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets its specific favorite site with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify contributor user gets its specific favorite site with Rest API and response is successful (200)")
public void contributorUserGetsFavoriteSiteWithSuccess() throws Exception
{
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -74,13 +82,16 @@ public class GetFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(contributorUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(contributorUser)
.onCoreAPI()
.usingAuthUser().getFavoriteSite(siteModel1)
.assertThat().field("id").is(siteModel1.getId())
.and().field("title").isNotNull();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets its specific favorite site with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify consumer user gets its specific favorite site with Rest API and response is successful (200)")
public void consumerUserGetsFavoriteSiteWithSuccess() throws Exception
{
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -89,13 +100,16 @@ public class GetFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(consumerUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(consumerUser)
.onCoreAPI()
.usingAuthUser().getFavoriteSite(siteModel1)
.assertThat().field("id").is(siteModel1.getId())
.and().field("title").isNotNull();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets specific favorite site of any user with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin user gets specific favorite site of any user with Rest API and response is successful (200)")
public void adminUserGetsAnyFavoriteSiteWithSuccess() throws Exception
{
UserModel adminUset = dataUser.getAdminUser();
@@ -104,13 +118,16 @@ public class GetFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(anyUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(adminUset)
.onCoreAPI()
.usingAuthUser().getFavoriteSite(siteModel1)
.assertThat().field("id").is(siteModel1.getId())
.and().field("title").isNotNull();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user fails to get specific favorite site of another user with Rest API and response is successful (403)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify manager user fails to get specific favorite site of another user with Rest API and response is successful (403)")
public void managerUserFailsToGetFavoriteSiteOfAnotherUser() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -119,12 +136,15 @@ public class GetFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(managerUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingUser(userModel).getFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@Bug(id = "MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized gets its specific favorite site with Rest API when authentication fails (401)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify manager user is NOT Authorized gets its specific favorite site with Rest API when authentication fails (401)")
public void managerUserNotAuthorizedFailsToGetFavoriteSite() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -134,6 +154,7 @@ public class GetFavoriteSiteSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser().getFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -27,7 +27,9 @@ public class GetFavoriteSitesSanityTests extends RestTest
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user fails to get an user favorite sites with Rest API (403)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify manager user fails to get an user favorite sites with Rest API (403)")
public void managerUserFailsToGetAnUserFavoriteSites() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -36,12 +38,14 @@ public class GetFavoriteSitesSanityTests extends RestTest
dataSite.usingUser(anotherUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingUser(anotherUser).getFavoriteSites();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user fails to get an user favorite sites with Rest API (403)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify collaborator user fails to get an user favorite sites with Rest API (403)")
public void collaboratorUserFailsToGetAnUserFavoriteSites() throws Exception
{
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -51,12 +55,14 @@ public class GetFavoriteSitesSanityTests extends RestTest
dataSite.usingUser(contributorUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(collaboratorUser)
.onCoreAPI()
.usingUser(contributorUser).getFavoriteSites();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user fails to get an user favorite sites with Rest API (403)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify contributor user fails to get an user favorite sites with Rest API (403)")
public void contributorUserFailsToGetAnUserFavoriteSites() throws Exception
{
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -66,12 +72,14 @@ public class GetFavoriteSitesSanityTests extends RestTest
dataSite.usingUser(contributorUser2).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(contributorUser)
.onCoreAPI()
.usingUser(contributorUser2).getFavoriteSites();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user fails to get an user favorite sites with Rest API (403)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify consumer user fails to get an user favorite sites with Rest API (403)")
public void consumerUserFailsToGetAnUserFavoriteSites() throws Exception
{
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -81,12 +89,14 @@ public class GetFavoriteSitesSanityTests extends RestTest
dataSite.usingUser(collaboratorUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(consumerUser)
.onCoreAPI()
.usingUser(collaboratorUser).getFavoriteSites();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets its favorite sites with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin user gets its favorite sites with Rest API and response is successful (200)")
public void adminUserGetsFavoriteSitesWithSuccess() throws Exception
{
UserModel adminUser = dataUser.getAdminUser();
@@ -94,6 +104,7 @@ public class GetFavoriteSitesSanityTests extends RestTest
dataSite.usingUser(anotherUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingUser(anotherUser).getFavoriteSites()
.assertThat().entriesListIsNotEmpty()
.and().paginationExist()
@@ -101,13 +112,16 @@ public class GetFavoriteSitesSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify any user gets its own user favorite sites with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify any user gets its own user favorite sites with Rest API and response is successful (200)")
public void anyUserGetsItsUserFavoriteSites() throws Exception
{
UserModel anyUser = dataUser.usingAdmin().createRandomTestUser();
dataSite.usingUser(anyUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(anyUser)
.onCoreAPI()
.usingAuthUser().getFavoriteSites()
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("id", siteModel.getId())
@@ -116,7 +130,9 @@ public class GetFavoriteSitesSanityTests extends RestTest
}
@Bug(id = "MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify any user is NOT Authorized to get its favorite sites with Rest API when authentication fails (401)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify any user is NOT Authorized to get its favorite sites with Rest API when authentication fails (401)")
public void anyUserNotAuthenticatedIsNotAuthorizedToGetFavoriteSites() throws Exception
{
UserModel anyUser = dataUser.usingAdmin().createRandomTestUser();
@@ -124,6 +140,7 @@ public class GetFavoriteSitesSanityTests extends RestTest
anyUser.setPassword("newpassword");
restClient.authenticateUser(anyUser)
.onCoreAPI()
.usingAuthUser().getFavoriteSites();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -34,7 +34,9 @@ public class GetPeopleActivitiesSanityTests extends RestTest
dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify manager user gets its activities with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
executionType = ExecutionType.SANITY,
description = "Verify manager user gets its activities with Rest API and response is successful")
public void managerUserShouldGetPeopleActivitiesList() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -42,6 +44,7 @@ public class GetPeopleActivitiesSanityTests extends RestTest
dataContent.usingUser(managerUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser().getPersonActivities()
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId())
@@ -49,7 +52,9 @@ public class GetPeopleActivitiesSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets its activities with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
executionType = ExecutionType.SANITY,
description = "Verify collaborator user gets its activities with Rest API and response is successful")
public void collaboratorUserShouldGetPeopleActivitiesList() throws Exception
{
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -57,6 +62,7 @@ public class GetPeopleActivitiesSanityTests extends RestTest
dataContent.usingUser(collaboratorUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(collaboratorUser)
.onCoreAPI()
.usingAuthUser().getPersonActivities()
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId())
@@ -64,7 +70,9 @@ public class GetPeopleActivitiesSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets its activities with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
executionType = ExecutionType.SANITY,
description = "Verify contributor user gets its activities with Rest API and response is successful")
public void contributorUserShouldGetPeopleActivitiesList() throws Exception
{
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -72,6 +80,7 @@ public class GetPeopleActivitiesSanityTests extends RestTest
dataContent.usingUser(contributorUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(contributorUser)
.onCoreAPI()
.usingAuthUser().getPersonActivities()
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId())
@@ -79,13 +88,16 @@ public class GetPeopleActivitiesSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets its activities with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
executionType = ExecutionType.SANITY,
description = "Verify consumer user gets its activities with Rest API and response is successful")
public void consumerUserShouldGetPeopleActivitiesList() throws Exception
{
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(consumerUser)
.onCoreAPI()
.usingAuthUser().getPersonActivities()
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId())
@@ -93,11 +105,14 @@ public class GetPeopleActivitiesSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify admin user gets another user activities with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
executionType = ExecutionType.SANITY,
description = "Verify admin user gets another user activities with Rest API and response is successful")
public void adminUserShouldGetPeopleActivitiesList() throws Exception
{
restClient.authenticateUser(dataUser.getAdminUser())
.usingUser(userModel).getPersonActivities()
.onCoreAPI()
.usingUser(userModel).getPersonActivities()
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId())
.and().paginationExist();
@@ -105,7 +120,9 @@ public class GetPeopleActivitiesSanityTests extends RestTest
}
@Bug(id = "MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to gets another user activities with Rest API")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
executionType = ExecutionType.SANITY,
description = "Verify manager user is NOT Authorized to gets another user activities with Rest API")
public void managerUserShouldGetPeopleActivitiesListIsNotAuthorized() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -113,7 +130,8 @@ public class GetPeopleActivitiesSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser)
.usingUser(userModel).getPersonActivities();
.onCoreAPI()
.usingUser(userModel).getPersonActivities();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -40,7 +40,7 @@ public class GetPeoplePreferenceSanityTests extends RestTest
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(managerUser)
.usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.onCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.assertThat().field("id").is( PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.and().field("value").is("true");
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -54,7 +54,7 @@ public class GetPeoplePreferenceSanityTests extends RestTest
dataSite.usingUser(collaboratorUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(collaboratorUser)
.usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.onCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.and().field("value").is("true");
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -68,7 +68,7 @@ public class GetPeoplePreferenceSanityTests extends RestTest
dataSite.usingUser(contributorUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(contributorUser)
.usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.onCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.and().field("value").is("true");
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -82,7 +82,7 @@ public class GetPeoplePreferenceSanityTests extends RestTest
dataSite.usingUser(consumerUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(consumerUser)
.usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.onCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.and().field("value").is("true");
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -95,7 +95,7 @@ public class GetPeoplePreferenceSanityTests extends RestTest
dataSite.usingUser(adminUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(adminUser)
.usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.onCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
.and().field("value").is("true");
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -111,7 +111,7 @@ public class GetPeoplePreferenceSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser)
.usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
.onCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -32,7 +32,9 @@ public class GetPeoplePreferencesSanityTests extends RestTest
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user gets its preferences with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
executionType = ExecutionType.SANITY,
description = "Verify manager user gets its preferences with Rest API and response is successful (200)")
public void managerUserGetsPeoplePreferencesWithSuccess() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -40,6 +42,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser()
.getPersonPreferences().assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
@@ -47,7 +50,9 @@ public class GetPeoplePreferencesSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets its preferences with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
executionType = ExecutionType.SANITY,
description = "Verify collaborator user gets its preferences with Rest API and response is successful (200)")
public void collaboratorUserGetsPeoplePreferencesWithSuccess() throws Exception
{
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -55,13 +60,16 @@ public class GetPeoplePreferencesSanityTests extends RestTest
dataSite.usingUser(collaboratorUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(collaboratorUser)
.onCoreAPI()
.usingAuthUser().getPersonPreferences().assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
.assertThat().paginationExist()
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets its preferences with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
executionType = ExecutionType.SANITY,
description = "Verify contributor user gets its preferences with Rest API and response is successful (200)")
public void contributorUserGetsPeoplePreferencesWithSuccess() throws Exception
{
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -69,13 +77,16 @@ public class GetPeoplePreferencesSanityTests extends RestTest
dataSite.usingUser(contributorUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(contributorUser)
.onCoreAPI()
.usingAuthUser().getPersonPreferences().assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
.assertThat().paginationExist()
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets its preferences with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
executionType = ExecutionType.SANITY,
description = "Verify consumer user gets its preferences with Rest API and response is successful (200)")
public void consumerUserGetsPeoplePreferencesWithSuccess() throws Exception
{
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -83,13 +94,16 @@ public class GetPeoplePreferencesSanityTests extends RestTest
dataSite.usingUser(consumerUser).usingSite(siteModel).addSiteToFavorites();
restClient.authenticateUser(consumerUser)
.onCoreAPI()
.usingAuthUser().getPersonPreferences().assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify admin user gets another user preferences with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
executionType = ExecutionType.SANITY,
description = "Verify admin user gets another user preferences with Rest API and response is successful (200)")
public void adminUserGetsPeoplePreferencesWithSuccess() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -98,14 +112,17 @@ public class GetPeoplePreferencesSanityTests extends RestTest
UserModel adminUser = dataUser.getAdminUser();
restClient.authenticateUser(adminUser)
.usingUser(managerUser).getPersonPreferences().assertThat().entriesListIsNotEmpty()
.onCoreAPI()
.usingUser(managerUser).getPersonPreferences().assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id = "MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to gets its preferences with Rest API when authentication fails(401)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
executionType = ExecutionType.SANITY,
description = "Verify manager user is NOT Authorized to gets its preferences with Rest API when authentication fails(401)")
public void managerUserGetsPeoplePreferencesIsNotAUthorized() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -114,6 +131,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingAuthUser()
.getPersonPreferences();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
@@ -29,13 +29,16 @@ public class GetPeopleSanityTests extends RestTest
searchedUser = dataUser.createRandomTestUser();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets a person with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify manager user gets a person with Rest API and response is successful")
public void managerUserChecksIfPersonIsPresent() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingUser(searchedUser)
.getPerson()
.assertThat().field("id").is(searchedUser.getUsername())
@@ -45,13 +48,16 @@ public class GetPeopleSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets a person with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify collaborator user gets a person with Rest API and response is successful")
public void collaboratorUserChecksIfPersonIsPresent() throws Exception
{
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
dataUser.usingUser(userModel).addUserToSite(collaboratorUser, siteModel, UserRole.SiteCollaborator);
restClient.authenticateUser(collaboratorUser)
.onCoreAPI()
.usingUser(searchedUser)
.getPerson()
.assertThat().field("id").is(searchedUser.getUsername())
@@ -62,13 +68,16 @@ public class GetPeopleSanityTests extends RestTest
}
@Test(groups = TestGroup.COMMENTS)
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets a person with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify contributor user gets a person with Rest API and response is successful")
public void contributorUserChecksIfPersonIsPresent() throws Exception
{
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
restClient.authenticateUser(contributorUser)
.onCoreAPI()
.usingUser(searchedUser)
.getPerson()
.assertThat().field("id").is(searchedUser.getUsername())
@@ -78,13 +87,16 @@ public class GetPeopleSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets a person with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify consumer user gets a person with Rest API and response is successful")
public void consumerUserChecksIfPersonIsPresent() throws Exception
{
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(consumerUser)
.onCoreAPI()
.usingUser(searchedUser)
.getPerson()
.assertThat().field("id").is(searchedUser.getUsername())
@@ -94,12 +106,15 @@ public class GetPeopleSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets a person with Rest API and response is successful")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin user gets a person with Rest API and response is successful")
public void adminUserChecksIfPersonIsPresent() throws Exception
{
UserModel adminUser = dataUser.getAdminUser();
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingUser(searchedUser)
.getPerson()
.assertThat().field("id").is(searchedUser.getUsername())
@@ -109,7 +124,9 @@ public class GetPeopleSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets a non existing person with Rest API and person is not found")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify manager user gets a non existing person with Rest API and person is not found")
public void managerUserChecksIfNonExistingPersonIsPresent() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -117,6 +134,7 @@ public class GetPeopleSanityTests extends RestTest
UserModel searchedNonUser = new UserModel("nonexistinguser", DataUser.PASSWORD);
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingUser(searchedNonUser)
.getPerson();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
@@ -48,10 +48,11 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingUser(newMember)
.addSiteMembershipRequest(siteModel);
restClient.usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.onCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -62,10 +63,11 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingUser(newMember)
.addSiteMembershipRequest(siteModel);
restClient.usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.onCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -76,10 +78,11 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.onCoreAPI()
.usingUser(newMember)
.addSiteMembershipRequest(siteModel);
restClient.usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.onCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -90,10 +93,11 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingUser(newMember)
.addSiteMembershipRequest(siteModel);
restClient.usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.onCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -104,10 +108,11 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingUser(newMember)
.addSiteMembershipRequest(siteModel);
restClient.usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.onCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -118,10 +123,11 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(new UserModel("random user", "random password"))
.onCoreAPI()
.usingUser(newMember)
.addSiteMembershipRequest(siteModel);
restClient.usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.onCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -35,6 +35,7 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -42,66 +43,83 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
}
@Bug(id = "MNT-16557")
@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)")
@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)
.onCoreAPI()
.usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id = "MNT-16557")
@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)")
@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)
.onCoreAPI()
.usingUser(newMember).getSiteMembershipRequests();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
}
@Bug(id = "MNT-16557")
@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)")
@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)
.onCoreAPI()
.usingUser(newMember).getSiteMembershipRequests();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
}
@Bug(id = "MNT-16557")
@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)")
@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)
.onCoreAPI()
.usingUser(newMember).getSiteMembershipRequests();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
}
@Bug(id = "MNT-16557")
@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)")
@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)
.onCoreAPI()
.usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@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)")
@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
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -109,15 +127,19 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser)
.onCoreAPI()
.usingUser(newMember).getSiteMembershipRequests();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@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)")
@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)
.usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
.onCoreAPI()
.usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
}
@@ -3,8 +3,6 @@ package org.alfresco.rest.people;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataSite;
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;
@@ -13,7 +11,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -21,12 +18,6 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
public class GetSiteMembershipSanityTests extends RestTest
{
@Autowired
DataUser dataUser;
@Autowired
DataSite dataSite;
private SiteModel siteModel;
private UserModel adminUser;
private ListUserWithRoles usersWithRoles;
@@ -42,11 +33,12 @@ public class GetSiteMembershipSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site manager is able to retrieve site membership information of another user")
executionType = ExecutionType.SANITY,
description = "Verify site manager is able to retrieve site membership information of another user")
public void siteManagerCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingUser(adminUser)
.getSiteMembership(siteModel)
.assertThat().field("role").is(UserRole.SiteManager)
@@ -55,11 +47,13 @@ public class GetSiteMembershipSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site collaborator is able to retrieve site membership information of another user")
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site collaborator is able to retrieve site membership information of another user")
public void siteCollaboratorCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingUser(adminUser)
.getSiteMembership(siteModel)
.onSite()
@@ -68,11 +62,13 @@ public class GetSiteMembershipSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site contributor is able to retrieve site membership information of another user")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site contributor is able to retrieve site membership information of another user")
public void siteContributorCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.onCoreAPI()
.usingUser(adminUser)
.getSiteMembership(siteModel)
.assertThat().field("role").is(UserRole.SiteManager)
@@ -81,11 +77,11 @@ public class GetSiteMembershipSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is able to retrieve site membership information of another user")
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is able to retrieve site membership information of another user")
public void siteConsumerCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingUser(adminUser)
.getSiteMembership(siteModel)
.assertThat().field("role").is(UserRole.SiteManager)
@@ -94,11 +90,13 @@ public class GetSiteMembershipSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to retrieve site membership information of another user")
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin user is able to retrieve site membership information of another user")
public void adminCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.getSiteMembership(siteModel)
.assertThat().field("role").is(UserRole.SiteManager)
@@ -107,12 +105,14 @@ public class GetSiteMembershipSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve site membership information of another user")
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify unauthenticated user is not able to retrieve site membership information of another user")
@Bug(id = "MNT-16904")
public void unauthenticatedUserCannotRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"))
.onCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.getSiteMembership(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
@@ -31,11 +31,12 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site manager is able to retrieve sites membership information of another user")
executionType = ExecutionType.SANITY,
description = "Verify site manager is able to retrieve sites membership information of another user")
public void siteManagerIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingUser(adminUser)
.getSitesMembershipInformation()
.assertThat().entriesListIsNotEmpty()
@@ -45,11 +46,12 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site collaborator is able to retrieve sites membership information of another user")
executionType = ExecutionType.SANITY,
description = "Verify site collaborator is able to retrieve sites membership information of another user")
public void siteCollaboratorIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingUser(adminUser)
.getSitesMembershipInformation()
.assertThat().entriesListIsNotEmpty()
@@ -59,11 +61,12 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site contributor is able to retrieve sites membership information of another user")
executionType = ExecutionType.SANITY,
description = "Verify site contributor is able to retrieve sites membership information of another user")
public void siteContributorIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.onCoreAPI()
.usingUser(adminUser)
.getSitesMembershipInformation()
.assertThat().entriesListIsNotEmpty()
@@ -73,11 +76,12 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify site consumer is able to retrieve sites membership information of another user")
executionType = ExecutionType.SANITY,
description = "Verify site consumer is able to retrieve sites membership information of another user")
public void siteConsumerIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.onCoreAPI()
.usingUser(adminUser)
.getSitesMembershipInformation()
.assertThat().entriesListIsNotEmpty()
@@ -87,11 +91,12 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify admin is able to retrieve sites membership information of another user")
executionType = ExecutionType.SANITY,
description = "Verify admin is able to retrieve sites membership information of another user")
public void siteAdminIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUser)
.onCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.getSitesMembershipInformation()
.assertThat().entriesListIsNotEmpty()
@@ -101,13 +106,14 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
executionType = ExecutionType.SANITY,
description = "Verify that unauthenticated user is not able to retrieve sites membership information")
executionType = ExecutionType.SANITY,
description = "Verify that unauthenticated user is not able to retrieve sites membership information")
@Bug(id = "MNT-16904")
public void unauthenticatedUserCannotRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
UserModel inexistentUser = new UserModel("inexistent user", "wrong password");
restClient.authenticateUser(inexistentUser)
.onCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.getSitesMembershipInformation();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
@@ -53,9 +53,10 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser()
.addSiteMembershipRequest(siteModel);
restClient.usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage)
restClient.onCoreAPI().usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage)
.assertMembershipRequestMessageIs(updatedMessage)
.and().field("id").is(siteModel.getId())
.and().field("modifiedAt").isNotEmpty();
@@ -70,10 +71,12 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser()
.addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.onCoreAPI()
.usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
@@ -88,10 +91,12 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser()
.addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.onCoreAPI()
.usingUser(newMember)
.updateSiteMembershipRequest(siteModel, updatedMessage);
@@ -107,10 +112,12 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser().addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
.onCoreAPI()
.usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
@@ -124,11 +131,13 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser()
.addSiteMembershipRequest(siteModel);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingUser(newMember)
.onCoreAPI()
.usingUser(newMember)
.updateSiteMembershipRequest(siteModel, updatedMessage);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
@@ -144,11 +153,13 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
UserModel otherMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser()
.addSiteMembershipRequest(siteModel);
restClient.authenticateUser(otherMember)
.usingUser(newMember)
.onCoreAPI()
.usingUser(newMember)
.updateSiteMembershipRequest(siteModel, updatedMessage);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
@@ -163,12 +174,14 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember)
.onCoreAPI()
.usingAuthUser()
.addSiteMembershipRequest(siteModel);
restClient.authenticateUser(adminUser)
.usingUser(newMember)
.updateSiteMembershipRequest(siteModel, updatedMessage);
.onCoreAPI()
.usingUser(newMember)
.updateSiteMembershipRequest(siteModel, updatedMessage);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
@@ -54,7 +54,7 @@ public class AddRatingSanityTests extends RestTest
public void managerIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.usingResource(document).likeDocument();
.onCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -67,7 +67,7 @@ public class AddRatingSanityTests extends RestTest
public void collaboratorIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingResource(document).likeDocument();
.onCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -79,7 +79,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Contributor role is able to post like rating to a document")
public void contributorIsAbleToLikeDocument() throws Exception
{
returnedRatingModel =restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(document).likeDocument();
returnedRatingModel =restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).onCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -91,7 +91,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Consumer role is able to post like rating to a document")
public void consumerIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(document).likeDocument();
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).onCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -103,7 +103,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to post like rating to a document")
public void adminIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(adminUser).usingResource(document).likeDocument();
returnedRatingModel = restClient.authenticateUser(adminUser).onCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -116,7 +116,7 @@ public class AddRatingSanityTests extends RestTest
@Bug(id = "MNT-16904")
public void unauthenticatedUserIsNotAbleToLikeDocument() throws Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).usingResource(document).likeDocument();
restClient.authenticateUser(new UserModel("random user", "random password")).onCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -124,7 +124,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Manager role is able to post stars rating to a document")
public void managerIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingResource(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -135,7 +135,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Collaborator role is able to post stars rating to a document")
public void collaboratorIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -147,7 +147,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Contributor role is able to post stars rating to a document")
public void contributorIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -158,7 +158,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Consumer role is able to post stars rating to a document")
public void consumerIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -169,7 +169,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to post stars rating to a document")
public void adminIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(adminUser).usingResource(document).rateStarsToDocument(3);
returnedRatingModel = restClient.authenticateUser(adminUser).onCoreAPI().usingResource(document).rateStarsToDocument(3);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is(String.valueOf(3))
.and().field("id").is("fiveStar")
@@ -181,7 +181,7 @@ public class AddRatingSanityTests extends RestTest
@Bug(id = "MNT-16904")
public void unauthenticatedUserIsNotAbleToRateStarsToDocument() throws Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).usingResource(document).rateStarsToDocument(5);
restClient.authenticateUser(new UserModel("random user", "random password")).onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -51,16 +51,16 @@ public class DeleteRatingSanityTests extends RestTest
public void managerIsAbleToDeleteItsOwnRatings() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.usingResource(document).deleteLikeRating();
restClient.onCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingResource(document).deleteFiveStarRating();
restClient.onCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
returnedRatingModelCollection = restClient.usingResource(document).getRatings();
returnedRatingModelCollection = restClient.onCoreAPI().usingResource(document).getRatings();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModelCollection.assertNodeIsNotLiked()
.assertNodeHasNoFiveStarRating()
@@ -74,16 +74,16 @@ public class DeleteRatingSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.usingResource(document).deleteLikeRating();
restClient.onCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingResource(document).deleteFiveStarRating();
restClient.onCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
returnedRatingModelCollection = restClient.usingResource(document).getRatings();
returnedRatingModelCollection = restClient.onCoreAPI().usingResource(document).getRatings();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModelCollection.assertNodeIsNotLiked()
.assertNodeHasNoFiveStarRating()
@@ -97,16 +97,16 @@ public class DeleteRatingSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.usingResource(document).deleteLikeRating();
restClient.onCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingResource(document).deleteFiveStarRating();
restClient.onCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
returnedRatingModelCollection = restClient.usingResource(document).getRatings();
returnedRatingModelCollection = restClient.onCoreAPI().usingResource(document).getRatings();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModelCollection.assertNodeIsNotLiked()
.assertNodeHasNoFiveStarRating()
@@ -120,16 +120,16 @@ public class DeleteRatingSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.usingResource(document).deleteLikeRating();
restClient.onCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingResource(document).deleteFiveStarRating();
restClient.onCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
returnedRatingModelCollection = restClient.usingResource(document).getRatings();
returnedRatingModelCollection = restClient.onCoreAPI().usingResource(document).getRatings();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModelCollection.assertNodeIsNotLiked()
.assertNodeHasNoFiveStarRating()
@@ -145,16 +145,16 @@ public class DeleteRatingSanityTests extends RestTest
restClient.authenticateUser(adminUser);
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.usingResource(document).deleteLikeRating();
restClient.onCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.usingResource(document).deleteFiveStarRating();
restClient.onCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
returnedRatingModelCollection = restClient.usingResource(document).getRatings();
returnedRatingModelCollection = restClient.onCoreAPI().usingResource(document).getRatings();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModelCollection.assertNodeIsNotLiked()
.assertNodeHasNoFiveStarRating()
@@ -169,15 +169,15 @@ public class DeleteRatingSanityTests extends RestTest
document = dataContent.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser);
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.usingResource(document).deleteLikeRating();
restClient.onCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
restClient.usingResource(document).deleteFiveStarRating();
restClient.onCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -191,15 +191,15 @@ public class DeleteRatingSanityTests extends RestTest
restClient.authenticateUser(userA);
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.authenticateUser(userB);
restClient.authenticateUser(userB).usingResource(document).deleteLikeRating();
restClient.authenticateUser(userB).onCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
restClient.usingResource(document).deleteFiveStarRating();
restClient.onCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -53,14 +53,14 @@ public class GetRatingSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restRatingModel = restClient.usingResource(document).getLikeRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
restRatingModel = restClient.usingResource(document).getFiveStarRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").is("5");
}
@@ -71,14 +71,14 @@ public class GetRatingSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restRatingModel = restClient.usingResource(document).getLikeRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
restRatingModel = restClient.usingResource(document).getFiveStarRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").is("5");
}
@@ -89,14 +89,14 @@ public class GetRatingSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restRatingModel = restClient.usingResource(document).getLikeRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
restRatingModel = restClient.usingResource(document).getFiveStarRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").is("5");
}
@@ -107,14 +107,14 @@ public class GetRatingSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restRatingModel = restClient.usingResource(document).getLikeRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
restRatingModel = restClient.usingResource(document).getFiveStarRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").is("5");
}
@@ -126,14 +126,14 @@ public class GetRatingSanityTests extends RestTest
document = dataContent.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser);
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restRatingModel = restClient.usingResource(document).getLikeRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
restRatingModel = restClient.usingResource(document).getFiveStarRating();
restRatingModel = restClient.onCoreAPI().usingResource(document).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
restRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").is("5");
}
@@ -144,15 +144,15 @@ public class GetRatingSanityTests extends RestTest
public void unauthenticatedUserIsNotAbleToRetrieveRating() throws Exception
{
restClient.authenticateUser(adminUser);
restClient.usingResource(document).likeDocument();
restClient.usingResource(document).rateStarsToDocument(5);
restClient.onCoreAPI().usingResource(document).likeDocument();
restClient.onCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.usingResource(document).getLikeRating();
restClient.onCoreAPI().usingResource(document).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(ErrorModel.AUTHENTICATION_FAILED);
restClient.usingResource(document).getFiveStarRating();
restClient.onCoreAPI().usingResource(document).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(ErrorModel.AUTHENTICATION_FAILED);
}
}
@@ -25,8 +25,11 @@ public class AddSiteMemberSanityTests extends RestTest
{
adminUserModel = dataUser.getAdminUser();
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
UserRole.SiteContributor);
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
UserRole.SiteManager,
UserRole.SiteCollaborator,
UserRole.SiteConsumer,
UserRole.SiteContributor);
}
@@ -37,7 +40,7 @@ public class AddSiteMemberSanityTests extends RestTest
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingSite(siteModel).addPerson(testUser)
restClient.onCoreAPI().usingSite(siteModel).addPerson(testUser)
.assertThat().field("id").is(testUser.getUsername())
.and().field("role").is(testUser.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -50,7 +53,7 @@ public class AddSiteMemberSanityTests extends RestTest
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingSite(siteModel).addPerson(testUser);
.onCoreAPI().usingSite(siteModel).addPerson(testUser);
restClient.assertLastError().containsSummary("Permission was denied");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
@@ -63,7 +66,7 @@ public class AddSiteMemberSanityTests extends RestTest
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.usingSite(siteModel).addPerson(testUser);
.onCoreAPI().usingSite(siteModel).addPerson(testUser);
restClient.assertLastError().containsSummary("Permission was denied");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
}
@@ -75,7 +78,7 @@ public class AddSiteMemberSanityTests extends RestTest
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingSite(siteModel).addPerson(testUser);
.onCoreAPI().usingSite(siteModel).addPerson(testUser);
restClient.assertLastError().containsSummary("Permission was denied");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
}
@@ -87,7 +90,7 @@ public class AddSiteMemberSanityTests extends RestTest
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(adminUserModel)
.usingSite(siteModel).addPerson(testUser)
.onCoreAPI().usingSite(siteModel).addPerson(testUser)
.and().field("id").is(testUser.getUsername())
.and().field("role").is(testUser.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -101,7 +104,7 @@ public class AddSiteMemberSanityTests extends RestTest
testUser.setUserRole(UserRole.SiteConsumer);
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser)
.usingSite(siteModel).addPerson(testUser);
.onCoreAPI().usingSite(siteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -40,8 +40,8 @@ public class GetSiteContainerSanityTests extends RestTest
public void getSiteContainerWithManagerRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
siteContainerModel = restClient.usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
siteContainerModel = restClient.onCoreAPI().usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.onCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
.assertThat().field("id").is(siteContainerModel.onModel().getId())
.and().field("folderId").is(siteContainerModel.onModel().getFolderId());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -52,8 +52,8 @@ public class GetSiteContainerSanityTests extends RestTest
public void getSiteContainerWithCollaboratorRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
siteContainerModel = restClient.usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
siteContainerModel = restClient.onCoreAPI().usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.onCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
.and().field("id").is(siteContainerModel.onModel().getId())
.and().field("folderId").is(siteContainerModel.onModel().getFolderId());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -64,8 +64,8 @@ public class GetSiteContainerSanityTests extends RestTest
public void getSiteContainerWithContributorRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
siteContainerModel = restClient.usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
siteContainerModel = restClient.onCoreAPI().usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.onCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
.assertThat().field("id").is(siteContainerModel.onModel().getId())
.and().field("folderId").is(siteContainerModel.onModel().getFolderId());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -76,8 +76,8 @@ public class GetSiteContainerSanityTests extends RestTest
public void getSiteContainerWithConsumerRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
siteContainerModel = restClient.usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
siteContainerModel = restClient.onCoreAPI().usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.onCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
.assertThat().field("id").is(siteContainerModel.onModel().getId())
.and().field("folderId").is(siteContainerModel.onModel().getFolderId());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -88,8 +88,8 @@ public class GetSiteContainerSanityTests extends RestTest
public void getSiteContainerWithAdminUser() throws Exception
{
restClient.authenticateUser(adminUserModel);
siteContainerModel = restClient.usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
siteContainerModel = restClient.onCoreAPI().usingSite(siteModel).getSiteContainers().getOneRandomEntry();
restClient.onCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel())
.assertThat().field("id").is(siteContainerModel.onModel().getId())
.and().field("folderId").is(siteContainerModel.onModel().getFolderId());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -102,12 +102,12 @@ public class GetSiteContainerSanityTests extends RestTest
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteContainer() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
siteContainerModel = restClient.usingSite(siteModel).getSiteContainers().getOneRandomEntry();
siteContainerModel = restClient.onCoreAPI().usingSite(siteModel).getSiteContainers().getOneRandomEntry();
userModel = dataUser.createRandomTestUser();
userModel.setPassword("user wrong password");
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel)
.usingSite(siteModel).getSiteContainer(siteContainerModel.onModel());
.onCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel());
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -47,7 +47,7 @@ public class GetSiteContainersSanityTests extends RestTest
public void getSiteContainersWithManagerRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingSite(siteModel).getSiteContainers()
restClient.onCoreAPI().usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
@@ -59,10 +59,10 @@ public class GetSiteContainersSanityTests extends RestTest
public void getSiteContainersWithCollaboratorRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.onCoreAPI().usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -71,10 +71,10 @@ public class GetSiteContainersSanityTests extends RestTest
public void getSiteContainersWithContributorRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.onCoreAPI().usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -83,10 +83,10 @@ public class GetSiteContainersSanityTests extends RestTest
public void getSiteContainersWithConsumerRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.onCoreAPI().usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -95,10 +95,10 @@ public class GetSiteContainersSanityTests extends RestTest
public void getSiteContainersWithAdminUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
restClient.usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.onCoreAPI().usingSite(siteModel).getSiteContainers()
.assertThat().entriesListIsNotEmpty()
.assertThat().paginationExist()
.and().paginationField("count").isNot("0");
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -110,8 +110,8 @@ public class GetSiteContainersSanityTests extends RestTest
userModel = dataUser.createRandomTestUser();
userModel.setPassword("user wrong password");
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel);
restClient.usingSite(siteModel).getSiteContainers();
restClient.authenticateUser(userModel)
.onCoreAPI().usingSite(siteModel).getSiteContainers();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -42,7 +42,7 @@ public class GetSiteMemberSanityTests extends RestTest
public void getSiteMemberWithManagerRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingSite(siteModel).getSiteMember(userModel)
restClient.onCoreAPI().usingSite(siteModel).getSiteMember(userModel)
.assertThat().field("id").is(userModel.getUsername())
.and().field("role").is(userModel.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -53,7 +53,7 @@ public class GetSiteMemberSanityTests extends RestTest
public void getSiteMemberWithCollaboratorRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingSite(siteModel).getSiteMember(userModel)
restClient.onCoreAPI().usingSite(siteModel).getSiteMember(userModel)
.and().field("id").is(userModel.getUsername())
.and().field("role").is(userModel.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -64,7 +64,7 @@ public class GetSiteMemberSanityTests extends RestTest
public void getSiteMemberWithContributorRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingSite(siteModel).getSiteMember(userModel)
restClient.onCoreAPI().usingSite(siteModel).getSiteMember(userModel)
.and().field("id").is(userModel.getUsername())
.and().field("role").is(userModel.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -75,7 +75,7 @@ public class GetSiteMemberSanityTests extends RestTest
public void getSiteMemberWithConsumerRole() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingSite(siteModel).getSiteMember(userModel)
restClient.onCoreAPI().usingSite(siteModel).getSiteMember(userModel)
.and().field("id").is(userModel.getUsername())
.and().field("role").is(userModel.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -86,7 +86,7 @@ public class GetSiteMemberSanityTests extends RestTest
public void getSiteMemberWithAdminUser() throws Exception
{
restClient.authenticateUser(adminUser);
restClient.usingSite(siteModel).getSiteMember(userModel)
restClient.onCoreAPI().usingSite(siteModel).getSiteMember(userModel)
.and().field("id").is(userModel.getUsername())
.and().field("role").is(userModel.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -99,7 +99,7 @@ public class GetSiteMemberSanityTests extends RestTest
{
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser);
restClient.usingSite(siteModel).getSiteMember(userModel);
restClient.onCoreAPI().usingSite(siteModel).getSiteMember(userModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -48,7 +48,7 @@ public class GetSiteMembersSanityTests extends RestTest
public void getSiteMembersWithManagerRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.onCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername())
.and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUserRole().toString());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -59,7 +59,7 @@ public class GetSiteMembersSanityTests extends RestTest
public void getSiteMembersWithCollaboratorRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty().assertThat()
.onCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty().assertThat()
.entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()).and()
.entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUserRole().toString());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -70,7 +70,7 @@ public class GetSiteMembersSanityTests extends RestTest
public void getSiteMembersWithContributorRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.onCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUsername())
.and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUserRole().toString());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -81,7 +81,7 @@ public class GetSiteMembersSanityTests extends RestTest
public void getSiteMembersWithConsumerRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.onCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUsername())
.and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUserRole().toString());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -92,7 +92,7 @@ public class GetSiteMembersSanityTests extends RestTest
public void getSiteMembersWithAdminUser() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUser)
.usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.onCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListIsNotEmpty()
.and().entriesListContains("id", adminUser.getUsername())
.when().assertThat().entriesListContains("role", "SiteManager");
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -107,7 +107,7 @@ public class GetSiteMembersSanityTests extends RestTest
userModel.setPassword("user wrong password");
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel)
.usingSite(siteModel).getSiteMembers();
.onCoreAPI().usingSite(siteModel).getSiteMembers();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -50,7 +50,7 @@ public class GetSiteSanityTests extends RestTest
public void getSiteWithManagerRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.usingSite(siteModel)
.onCoreAPI().usingSite(siteModel)
.getSite()
.and().field("id").is(siteModel.getId())
.and().field("title").is(siteModel.getTitle());
@@ -63,7 +63,7 @@ public class GetSiteSanityTests extends RestTest
public void getSiteWithCollaboratorRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingSite(siteModel)
.onCoreAPI().usingSite(siteModel)
.getSite()
.and().field("id").is(siteModel.getId())
.and().field("title").is(siteModel.getTitle());
@@ -75,7 +75,7 @@ public class GetSiteSanityTests extends RestTest
public void getSiteWithContributorRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.usingSite(siteModel)
.onCoreAPI().usingSite(siteModel)
.getSite()
.and().field("id").is(siteModel.getId())
.and().field("title").is(siteModel.getTitle());
@@ -87,7 +87,7 @@ public class GetSiteSanityTests extends RestTest
public void getSiteWithConsumerRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingSite(siteModel)
.onCoreAPI().usingSite(siteModel)
.getSite()
.and().field("id").is(siteModel.getId())
.and().field("title").is(siteModel.getTitle());
@@ -99,7 +99,7 @@ public class GetSiteSanityTests extends RestTest
public void getSiteWithAdminRole() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel)
.usingSite(siteModel)
.onCoreAPI().usingSite(siteModel)
.getSite()
.and().field("id").is(siteModel.getId())
.and().field("title").is(siteModel.getTitle());
@@ -115,7 +115,8 @@ public class GetSiteSanityTests extends RestTest
userModel.setPassword("user wrong password");
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel).withParams("maxItems=10000")
.getSites();
.onCoreAPI()
.getSites();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -48,7 +48,7 @@ public class GetSitesSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.getSites()
.onCoreAPI().getSites()
.assertThat().entriesListIsNotEmpty()
.assertThat().entriesListContains("id", siteModel.getId())
.and().paginationExist();
@@ -60,7 +60,7 @@ public class GetSitesSanityTests extends RestTest
public void collaboratorIsAbleToRetrieveSites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.getSites().assertThat().entriesListIsNotEmpty()
.onCoreAPI().getSites().assertThat().entriesListIsNotEmpty()
.assertThat().entriesListContains("id", siteModel.getId())
.and().paginationExist();
@@ -73,7 +73,7 @@ public class GetSitesSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.getSites()
.onCoreAPI().getSites()
.assertThat().entriesListIsNotEmpty()
.assertThat().entriesListContains("id", siteModel.getId())
.and().paginationExist();
@@ -86,7 +86,7 @@ public class GetSitesSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.getSites()
.onCoreAPI().getSites()
.assertThat().entriesListIsNotEmpty()
.assertThat().entriesListContains("id", siteModel.getId())
.and().paginationExist();
@@ -98,7 +98,7 @@ public class GetSitesSanityTests extends RestTest
public void adminUserIsAbleToRetrieveSites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel)
.getSites()
.onCoreAPI().getSites()
.assertThat().entriesListIsNotEmpty()
.assertThat().entriesListContains("id", siteModel.getId())
.and().paginationExist();
@@ -115,7 +115,7 @@ public class GetSitesSanityTests extends RestTest
userModel.setPassword("user wrong password");
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel)
.getSites();
.onCoreAPI().getSites();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -49,9 +49,9 @@ public class RemoveSiteMemberSanityTests extends RestTest
description = "Verify that site manager can delete site member and gets status code 204, 'No Content'")
public void siteManagerIsAbleToDeleteSiteMember() throws Exception{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.onCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.getSites().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername());
restClient.onCoreAPI().getSites().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -60,10 +60,10 @@ public class RemoveSiteMemberSanityTests extends RestTest
description = "Verify that site collaborator cannot delete site member and gets status code 403, 'Forbidden'")
public void siteCollaboratorIsNotAbleToDeleteSiteMember() throws Exception{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.onCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.onCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -72,10 +72,10 @@ public class RemoveSiteMemberSanityTests extends RestTest
description = "Verify that site contributor cannot delete site member and gets status code 403, 'Forbidden'")
public void siteContributorIsNotAbleToDeleteSiteMember() throws Exception{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.onCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.onCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -84,10 +84,10 @@ public class RemoveSiteMemberSanityTests extends RestTest
description = "Verify that site consumer cannot delete site member and gets status code 403, 'Forbidden'")
public void siteConsumerIsNotAbleToDeleteSiteMember() throws Exception{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingSite(siteModel).deleteSiteMember(testUserModel);
.onCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.onCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -95,10 +95,10 @@ public class RemoveSiteMemberSanityTests extends RestTest
description = "Verify that admin user can delete site member and gets status code 204, 'No Content'")
public void adminUserIsAbleToDeleteSiteMember() throws Exception{
restClient.authenticateUser(adminUserModel)
.usingSite(siteModel).deleteSiteMember(testUserModel);
.onCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.getSites().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername());
restClient.onCoreAPI().getSites().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -107,7 +107,7 @@ public class RemoveSiteMemberSanityTests extends RestTest
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMember() throws Exception{
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser)
.usingSite(siteModel).deleteSiteMember(testUserModel);
.onCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -38,7 +38,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
testUserModel.setUserRole(UserRole.SiteConsumer);
restClient.usingSite(siteModel).updateSiteMember(testUserModel)
restClient.onCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel)
.assertThat().field("id").is(testUserModel.getUsername())
.and().field("role").is(testUserModel.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -51,7 +51,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.usingSite(siteModel).updateSiteMember(testUserModel);
restClient.onCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
restClient.assertLastError()
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", siteModel.getTitle()));
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
@@ -64,7 +64,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.usingSite(siteModel).updateSiteMember(testUserModel);
restClient.onCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
restClient.assertLastError()
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", siteModel.getTitle()));
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
@@ -77,7 +77,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.usingSite(siteModel).updateSiteMember(testUserModel);
restClient.onCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
restClient.assertLastError()
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", siteModel.getTitle()));
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
@@ -89,7 +89,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
{
restClient.authenticateUser(adminUserModel);
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.usingSite(siteModel).updateSiteMember(testUserModel)
restClient.onCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel)
.assertThat().field("id").is(testUserModel.getUsername())
.and().field("role").is(testUserModel.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -102,7 +102,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser);
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.usingSite(siteModel).updateSiteMember(testUserModel);
restClient.onCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -29,14 +29,14 @@ public class GetProcessDefinitionImageSanityTests extends RestWorkflowTest
{
testUser = dataUser.createRandomTestUser();
restClient.authenticateUser(dataUser.getAdminUser());
randomProcessDefinition = restClient.getAllProcessDefinitions().getOneRandomEntry();
randomProcessDefinition = restClient.onWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION }, executionType = ExecutionType.SANITY, description = "Verify Any user gets a specific process definition image for non-network deployments using REST API and status code is OK (200)")
public void anyUserGetsProcessDefinitionImage() throws Exception
{
restClient.authenticateUser(testUser);
restClient.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionImage()
restClient.onWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionImage()
.assertResponseContainsImage();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -44,7 +44,7 @@ public class GetProcessDefinitionImageSanityTests extends RestWorkflowTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION }, executionType = ExecutionType.SANITY, description = "Verify Admin user gets a specific process definition image for non-network deployments using REST API and status code is OK (200)")
public void adminGetsProcessDefinitionImage() throws Exception
{
restClient.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionImage()
restClient.onWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionImage()
.assertResponseContainsImage();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -28,7 +28,7 @@ public class GetProcessDefinitionSanityTests extends RestWorkflowTest
{
testUser = dataUser.createRandomTestUser();
restClient.authenticateUser(dataUser.getAdminUser());
randomProcessDefinition = restClient.getAllProcessDefinitions().getOneRandomEntry();
randomProcessDefinition = restClient.onWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
@@ -36,9 +36,9 @@ public class GetProcessDefinitionSanityTests extends RestWorkflowTest
description = "Verify Admin user gets a specific process definition for non-network deployments using REST API and status code is OK (200)")
public void adminGetsProcessDefinition() throws Exception
{
restClient.usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().
restClient.onWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().
assertThat().field("name").is(randomProcessDefinition.onModel().getName());
restClient.usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().assertThat().field("name")
restClient.onWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().assertThat().field("name")
.is(randomProcessDefinition.onModel().getName());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -49,7 +49,7 @@ public class GetProcessDefinitionSanityTests extends RestWorkflowTest
public void anyUserGetsProcessDefinition() throws Exception
{
restClient.authenticateUser(testUser);
restClient.usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().assertThat().field("name")
restClient.onWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().assertThat().field("name")
.is(randomProcessDefinition.onModel().getName());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -37,8 +37,8 @@ public class GetProcessDefinitionStartFormModelSanityTests extends RestWorkflowT
description = "Verify Admin gets a model of the start form type definition for non-network deployments using REST API and status code is OK (200)")
public void nonNetworkAdminGetsStartFormModel() throws Exception
{
randomProcessDefinition = restClient.getAllProcessDefinitions().getOneRandomEntry();
restClient.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel().assertThat().entriesListIsNotEmpty();
randomProcessDefinition = restClient.onWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry();
restClient.onWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -50,8 +50,8 @@ public class GetProcessDefinitionStartFormModelSanityTests extends RestWorkflowT
{
restClient.usingTenant().createTenant(adminTenantUser);
restClient.authenticateUser(adminTenantUser);
randomProcessDefinition = restClient.getAllProcessDefinitions().getOneRandomEntry();
restClient.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel().assertThat().entriesListIsNotEmpty();
randomProcessDefinition = restClient.onWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry();
restClient.onWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
}
@@ -5,7 +5,11 @@ import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.rest.model.RestItemModel;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.utility.model.*;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
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;
@@ -43,8 +47,8 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
document2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file content");
dataContent.usingSite(siteModel).createContent(document2);
processModel = restClient.authenticateUser(adminUser).getProcesses().getOneRandomEntry().onModel();
processItem = restClient.usingProcess(processModel).addProcessItem(document2);
processModel = restClient.authenticateUser(adminUser).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processItem = restClient.onWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processItem.assertThat().field("createdAt").isNotEmpty()
.and().field("size").is(document2.getContent().length())
@@ -55,7 +59,7 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
.and().field("id").isNotEmpty()
.and().field("mimeType").is(document2.getFileType().mimeType);
restClient.usingProcess(processModel).getProcessItems()
restClient.onWorkflowAPI().usingProcess(processModel).getProcessItems()
.assertThat().entriesListContains("id", processItem.getId());
}
@@ -66,8 +70,8 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
{
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
processModel = restClient.authenticateUser(adminUser).getProcesses().getOneRandomEntry().onModel();
processItem = restClient.usingProcess(processModel).addProcessItem(document2);
processModel = restClient.authenticateUser(adminUser).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processItem = restClient.onWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processItem.assertThat().field("createdAt").isNotEmpty()
.and().field("size").is("19")
@@ -78,10 +82,10 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
.and().field("id").isNotEmpty()
.and().field("mimeType").is(document2.getFileType().mimeType);
restClient.usingProcess(processModel).getProcessItems()
restClient.onWorkflowAPI().usingProcess(processModel).getProcessItems()
.assertThat().entriesListContains("id", processItem.getId())
.and().entriesListContains("name", document2.getName());
restClient.usingProcess(processModel).addProcessItem(document2);
restClient.onWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
}
}
@@ -9,7 +9,6 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.Test;
@@ -31,12 +30,12 @@ public class AddProcessSanityTests extends RestWorkflowTest
userWhoStartsProcess = dataUser.createRandomTestUser();
assignee = dataUser.createRandomTestUser();
addedProcess = restClient.authenticateUser(userWhoStartsProcess).addProcess("activitiAdhoc", assignee, false, Priority.Normal);
addedProcess = restClient.authenticateUser(userWhoStartsProcess).onWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
addedProcess.assertThat().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
processes = restClient.getProcesses();
processes = restClient.onWorkflowAPI().getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
processes.assertThat().entriesListContains("id", addedProcess.getId());
}
@@ -52,12 +51,12 @@ public class AddProcessSanityTests extends RestWorkflowTest
tenantUserWhoStartsProcess = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
tenantAssignee = dataUser.usingUser(adminTenantUser).createUserWithTenant("u2Tenant");
addedProcess = restClient.authenticateUser(tenantUserWhoStartsProcess).addProcess("activitiAdhoc", tenantAssignee, false, Priority.Normal);
addedProcess = restClient.authenticateUser(tenantUserWhoStartsProcess).onWorkflowAPI().addProcess("activitiAdhoc", tenantAssignee, false, Priority.Normal);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
addedProcess.assertThat().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
processes = restClient.getProcesses();
processes = restClient.onWorkflowAPI().getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
processes.assertThat().entriesListContains("id", addedProcess.getId());
}
@@ -1,7 +1,7 @@
package org.alfresco.rest.workflow.processes;
import org.alfresco.dataprep.CMISUtil.Priority;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.dataprep.CMISUtil.Priority;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.rest.model.RestProcessVariableModel;
@@ -44,15 +44,15 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
public void addProcessVariable() throws Exception
{
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
processModel = restClient.authenticateUser(userWhoStartsTask).getProcesses().getOneRandomEntry().onModel();
processModel = restClient.authenticateUser(userWhoStartsTask).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processVariable = restClient.usingProcess(processModel).addProcessVariable(variableModel);
processVariable = restClient.onWorkflowAPI().usingProcess(processModel).addProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processVariable.assertThat().field("name").is(variableModel.getName())
.and().field("type").is(variableModel.getType())
.and().field("value").is(variableModel.getValue());
restClient.usingProcess(processModel).getProcessVariables()
restClient.onWorkflowAPI().usingProcess(processModel).getProcessVariables()
.assertThat().entriesListContains("name", processVariable.getName());
}
@@ -61,8 +61,8 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
public void updateExistingProcessVariable() throws Exception
{
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
processModel = restClient.authenticateUser(userWhoStartsTask).getProcesses().getOneRandomEntry().onModel();
processVariable = restClient.usingProcess(processModel).addProcessVariable(variableModel);
processModel = restClient.authenticateUser(userWhoStartsTask).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processVariable = restClient.onWorkflowAPI().usingProcess(processModel).addProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processVariable.assertThat().field("name").is(variableModel.getName())
.and().field("type").is(variableModel.getType())
@@ -70,7 +70,7 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
String newValue = RandomData.getRandomName("value");
variableModel.setValue(newValue);
processVariable = restClient.usingProcess(processModel).addProcessVariable(variableModel);
processVariable = restClient.onWorkflowAPI().usingProcess(processModel).addProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processVariable.assertThat().field("value").is(newValue);
}
@@ -85,10 +85,10 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
tenantUserAssignee = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenantAssignee");
restClient.authenticateUser(tenantUser).addProcess("activitiAdhoc", tenantUserAssignee, false, Priority.Normal);
restClient.authenticateUser(tenantUser).onWorkflowAPI().addProcess("activitiAdhoc", tenantUserAssignee, false, Priority.Normal);
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
processModel = restClient.authenticateUser(adminTenantUser).getProcesses().getOneRandomEntry().onModel();
processVariable = restClient.usingProcess(processModel).addProcessVariable(variableModel);
processModel = restClient.authenticateUser(adminTenantUser).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processVariable = restClient.onWorkflowAPI().usingProcess(processModel).addProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processVariable.assertThat().field("name").is(variableModel.getName())
.and().field("type").is(variableModel.getType())
@@ -100,8 +100,8 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
public void failedAddingProcessVariableIfInvalidBodyIsProvided() throws Exception
{
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("incorrect type");
processModel = restClient.authenticateUser(adminUser).getProcesses().getOneRandomEntry().onModel();
restClient.usingProcess(processModel).addProcessVariable(variableModel);
processModel = restClient.authenticateUser(adminUser).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
restClient.onWorkflowAPI().usingProcess(processModel).addProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
.assertLastError().containsSummary("Unsupported type of variable: 'incorrect type'.");
}
@@ -32,35 +32,35 @@ public class DeleteProcessSanityTests extends RestWorkflowTest
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User is able to delete process started by him using REST API and status code is OK (204)")
public void deleteProcessByUserWhoStartedProcess() throws Exception
{
process = restClient.authenticateUser(userWhoAddsProcess).addProcess("activitiAdhoc", assignee, false, Priority.Normal);
process = restClient.authenticateUser(userWhoAddsProcess).onWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.usingProcess(process).deleteProcess();
restClient.onWorkflowAPI().usingProcess(process).deleteProcess();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.getProcesses().assertThat().entriesListDoesNotContain("id", process.getId());
restClient.onWorkflowAPI().getProcesses().assertThat().entriesListDoesNotContain("id", process.getId());
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User is able to delete process assigned to him using REST API and status code is OK (204)")
public void deleteProcessByAssignedUser() throws Exception
{
process = restClient.authenticateUser(userWhoAddsProcess).addProcess("activitiAdhoc", assignee, false, Priority.Normal);
process = restClient.authenticateUser(userWhoAddsProcess).onWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(assignee).usingProcess(process).deleteProcess();
restClient.authenticateUser(assignee).onWorkflowAPI().usingProcess(process).deleteProcess();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.getProcesses().assertThat().entriesListDoesNotContain("id", process.getId());
restClient.onWorkflowAPI().getProcesses().assertThat().entriesListDoesNotContain("id", process.getId());
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User that is not involved in a process is not authorized to delete it using REST API and status code is 403")
public void deleteProcessByAnotherUser() throws Exception
{
process = restClient.authenticateUser(userWhoAddsProcess).addProcess("activitiAdhoc", assignee, false, Priority.Normal);
process = restClient.authenticateUser(userWhoAddsProcess).onWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(anotherUser).usingProcess(process).deleteProcess();
restClient.authenticateUser(anotherUser).onWorkflowAPI().usingProcess(process).deleteProcess();
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("user is not allowed to access information about process");
}
}
@@ -5,7 +5,6 @@ import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.rest.requests.Processes;
import org.alfresco.rest.requests.RestTenantApi;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.SiteModel;
@@ -41,7 +41,7 @@ public class GetProcessTasksSanityTests extends RestWorkflowTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify user who started the process gets all tasks of started process with Rest API and response is successfull (200)")
public void userWhoStartedProcessCanGetProcessTasks() throws JsonToModelConversionException, Exception
{
processTasks = restClient.authenticateUser(userModel).usingProcess(process).getProcessTasks();
processTasks = restClient.authenticateUser(userModel).onWorkflowAPI().usingProcess(process).getProcessTasks();
restClient.assertStatusCodeIs(HttpStatus.OK);
processTasks.assertThat()
.entriesListIsNotEmpty().and()
@@ -53,7 +53,7 @@ public class GetProcessTasksSanityTests extends RestWorkflowTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify any assignee user of the process gets all tasks of the process with Rest API and response is successfull (200)")
public void assigneeUserCanGetAllProcessTasks() throws JsonToModelConversionException, Exception
{
processTasks = restClient.authenticateUser(assignee1).usingProcess(process).getProcessTasks();
processTasks = restClient.authenticateUser(assignee1).onWorkflowAPI().usingProcess(process).getProcessTasks();
restClient.assertStatusCodeIs(HttpStatus.OK);
processTasks.assertThat()
.entriesListContains("assignee", assignee1.getUsername()).and()
@@ -68,7 +68,7 @@ public class GetProcessTasksSanityTests extends RestWorkflowTest
.createMoreReviewersWorkflowAndAssignTo(assignee1, assignee2, assignee3);
dataWorkflow.usingUser(assignee1).approveTask(process);
processTasks = restClient.authenticateUser(assignee2).usingProcess(process).getProcessTasks();
processTasks = restClient.authenticateUser(assignee2).onWorkflowAPI().usingProcess(process).getProcessTasks();
restClient.assertStatusCodeIs(HttpStatus.OK);
processTasks.assertThat()
.entriesListIsNotEmpty().assertThat()
@@ -41,8 +41,8 @@ public class GetProcessVariablesSanityTests extends RestWorkflowTest
description = "Verify that user that started the process gets all process variables")
public void getProcessVariablesUsingTheUserWhoStartedProcess() throws JsonToModelConversionException, Exception
{
processModel = restClient.authenticateUser(userWhoStartsTask).getProcesses().getOneRandomEntry().onModel();
variables = restClient.usingProcess(processModel).getProcessVariables();
processModel = restClient.authenticateUser(userWhoStartsTask).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
variables = restClient.onWorkflowAPI().usingProcess(processModel).getProcessVariables();
restClient.assertStatusCodeIs(HttpStatus.OK);
variables.assertThat().entriesListIsNotEmpty();
}
@@ -51,8 +51,8 @@ public class GetProcessVariablesSanityTests extends RestWorkflowTest
description = "Verify get all process variables call using a user that is involved in the process")
public void getProcessVariablesUsingUserInvolvedInProcess() throws JsonToModelConversionException, Exception
{
processModel = restClient.authenticateUser(assignee).getProcesses().getOneRandomEntry().onModel();
variables = restClient.usingProcess(processModel).getProcessVariables();
processModel = restClient.authenticateUser(assignee).onWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
variables = restClient.onWorkflowAPI().usingProcess(processModel).getProcessVariables();
restClient.assertStatusCodeIs(HttpStatus.OK);
variables.assertThat().entriesListIsNotEmpty();
}
@@ -37,7 +37,7 @@ public class GetProcessesSanityTests extends RestWorkflowTest
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User gets all processes started by him using REST API and status code is OK (200)")
public void getProcessesByUserWhoStartedProcess() throws Exception
{
allProcesses = restClient.authenticateUser(userWhoStartsTask).getProcesses();
allProcesses = restClient.authenticateUser(userWhoStartsTask).onWorkflowAPI().getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
allProcesses.assertThat().entriesListContains("id", task.getNodeRef());
}
@@ -46,7 +46,7 @@ public class GetProcessesSanityTests extends RestWorkflowTest
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User gets all processes assigned to him using REST API and status code is OK (200)")
public void getProcessesByAssignedUser() throws Exception
{
allProcesses = restClient.authenticateUser(assignee).getProcesses();
allProcesses = restClient.authenticateUser(assignee).onWorkflowAPI().getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
allProcesses.assertThat().entriesListContains("id", task.getNodeRef());
}
@@ -55,7 +55,7 @@ public class GetProcessesSanityTests extends RestWorkflowTest
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User that is not involved in a process can not get that process using REST API and status code is OK (200)")
public void getProcessesByAnotherUser() throws Exception
{
allProcesses = restClient.authenticateUser(anotherUser).getProcesses();
allProcesses = restClient.authenticateUser(anotherUser).onWorkflowAPI().getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
allProcesses.assertThat().entriesListDoesNotContain("id", task.getNodeRef());
}
@@ -64,7 +64,7 @@ public class GetProcessesSanityTests extends RestWorkflowTest
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify Admin gets all processes, even if he isn't involved in a process, using REST API and status code is OK (200)")
public void getProcessesByAdmin() throws Exception
{
allProcesses = restClient.authenticateUser(dataUser.getAdminUser()).getProcesses();
allProcesses = restClient.authenticateUser(dataUser.getAdminUser()).onWorkflowAPI().getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
allProcesses.assertThat().entriesListContains("id", task.getNodeRef());
}