mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Refactor Test: GetTaskCandidatesTests.java
This commit is contained in:
@@ -2,7 +2,7 @@ package org.alfresco.rest.workflow.tasks;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.requests.RestTasksApi;
|
||||
import org.alfresco.rest.model.RestCandidateModelsCollection;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
@@ -11,7 +11,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.Test;
|
||||
@@ -24,14 +23,12 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
|
||||
public class GetTaskCandidatesTests extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestTasksApi tasksApi;
|
||||
|
||||
private UserModel userModel, user, userModel1, userModel2;
|
||||
private SiteModel siteModel;
|
||||
private FileModel fileModel;
|
||||
private TaskModel taskModel;
|
||||
private GroupModel group;
|
||||
private RestCandidateModelsCollection candidateModels;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -45,39 +42,35 @@ public class GetTaskCandidatesTests extends RestTest
|
||||
group = dataGroup.createRandomGroup();
|
||||
dataGroup.addListOfUsersToGroup(group, userModel1, userModel2);
|
||||
taskModel = dataWorkflow.usingUser(user).usingSite(siteModel).usingResource(fileModel).createPooledReviewTaskAndAssignTo(group);
|
||||
tasksApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that admin gets task candidates")
|
||||
public void getTaskCandidatesByAdmin() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.getAdminUser());
|
||||
tasksApi.getTaskCandidates(taskModel)
|
||||
.assertThat().entriesListContains("candidateType", "group")
|
||||
candidateModels = restClient.authenticateUser(dataUser.getAdminUser()).withWorkflowAPI().usingTask(taskModel).getTaskCandidates();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
candidateModels.assertThat().entriesListContains("candidateType", "group")
|
||||
.and().entriesListContains("candidateId", String.format("GROUP_%s", group.getGroupIdentifier()));
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that user that started the process gets task candidates")
|
||||
public void getTaskCandidatesByUserWhoStartedProcess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(user);
|
||||
tasksApi.getTaskCandidates(taskModel)
|
||||
.assertThat().entriesListContains("candidateType", "group")
|
||||
candidateModels = restClient.authenticateUser(user).withWorkflowAPI().usingTask(taskModel).getTaskCandidates();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
candidateModels.assertThat().entriesListContains("candidateType", "group")
|
||||
.and().entriesListContains("candidateId", String.format("GROUP_%s", group.getGroupIdentifier()));
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that user from the assighed group to the process gets task candidates")
|
||||
public void getTaskCandidatesByCandidateUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel1);
|
||||
tasksApi.getTaskCandidates(taskModel)
|
||||
.assertThat().entriesListContains("candidateType", "group")
|
||||
candidateModels = restClient.authenticateUser(userModel1).withWorkflowAPI().usingTask(taskModel).getTaskCandidates();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
candidateModels.assertThat().entriesListContains("candidateType", "group")
|
||||
.and().entriesListContains("candidateId", String.format("GROUP_%s", group.getGroupIdentifier()));
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user