mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
TAS-1440, TAS-1614, TAS-1615, TAS-1616, TAS-1617 updateTask with different roles
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
package org.alfresco.rest.workflow.tasks;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.requests.RestTasksApi;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TaskModel;
|
||||
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.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
|
||||
public class UploadTaskSanityTests extends RestWorkflowTest
|
||||
{
|
||||
@Autowired
|
||||
RestTasksApi tasksApi;
|
||||
|
||||
UserModel userModel;
|
||||
SiteModel siteModel;
|
||||
UserModel candidateUser;
|
||||
FileModel fileModel;
|
||||
UserModel assigneeUser;
|
||||
TaskModel taskModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
assigneeUser = dataUser.createRandomTestUser();
|
||||
taskModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
|
||||
|
||||
tasksApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY, description = "Verify admin user updates task with Rest API and response is successfull (200)")
|
||||
public void adminUserUpdatesAnyTaskWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY, description = "Verify assignee user updates its assigned task with Rest API and response is successfull (200)")
|
||||
public void assigneeUserUpdatesItsTaskWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(assigneeUser);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY, description = "Verify user that started the task updates the started task with Rest API and response is successfull (200)")
|
||||
public void starterUserUpdatesItsTaskWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY, description = "Verify any user with no relation to task is forbidden to update other task with Rest API (403)")
|
||||
public void anyUserIsForbiddenToUpdateOtherTask() throws Exception
|
||||
{
|
||||
UserModel anyUser= dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(anyUser);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY, description = "Verify candidate user updates its specific task and no other user claimed the task with Rest API and response is successfull (200)")
|
||||
public void candidateUserUpdatesItsTasks() throws Exception
|
||||
{
|
||||
UserModel userModel1 = dataUser.createRandomTestUser();
|
||||
UserModel userModel2 = dataUser.createRandomTestUser();
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
dataGroup.addListOfUsersToGroup(group, userModel1, userModel2);
|
||||
TaskModel taskModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(fileModel).createPooledReviewTaskAndAssignTo(group);
|
||||
|
||||
restClient.authenticateUser(userModel1);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user