added some tests from TAS-2087

This commit is contained in:
cagache
2016-12-09 16:15:47 +02:00
parent 003edc5811
commit 46b6abbe65
@@ -0,0 +1,73 @@
package org.alfresco.rest.workflow.tasks;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestTaskModel;
import org.alfresco.utility.model.*;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Created by Claudia Agache on 12/9/2016.
*/
public class UpdateTaskCoreTestsBulk3 extends RestTest
{
UserModel owner;
SiteModel siteModel;
UserModel candidateUser;
FileModel fileModel;
UserModel assigneeUser;
TaskModel taskModel;
RestTaskModel restTaskModel;
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
owner = dataUser.createRandomTestUser();
siteModel = dataSite.usingUser(owner).createPublicRandomSite();
fileModel = dataContent.usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
assigneeUser = dataUser.createRandomTestUser();
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify task assignee can update task with status resolve")
public void resolveTaskAsCurrentAssignee() throws Exception
{
taskModel = dataWorkflow.usingUser(owner).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
restTaskModel = restClient.authenticateUser(assigneeUser)
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("resolved");
restClient.assertStatusCodeIs(HttpStatus.OK);
restTaskModel.assertThat().field("id").is(taskModel.getId())
.and().field("state").is("resolved");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify update task using invalid taskId")
public void updateTaskUsingInvalidTaskId() throws Exception
{
taskModel = dataWorkflow.usingUser(owner).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
taskModel.setId("invalidId");
restClient.authenticateUser(owner).withWorkflowAPI().usingTask(taskModel).updateTask("completed");
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidId"));
}
// @Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
// @TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
// description = "Verify update task using another priority")
// public void updateTaskUsingAnotherPriority() throws Exception
// {
// taskModel = dataWorkflow.usingUser(owner).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
//
// restTaskModel = restClient.authenticateUser(owner).withWorkflowAPI().usingTask(taskModel).updateTask("2");
// restClient.assertStatusCodeIs(HttpStatus.OK);
// restTaskModel.assertThat().field("priority").is(CMISUtil.Priority.Low);
// }
}