TAS-2924 two full tests added and one test updated for updateTask

This commit is contained in:
Cristina Axinte
2017-02-06 13:40:14 +02:00
parent 7f3a26957a
commit 91d5332074
2 changed files with 43 additions and 2 deletions
@@ -10,6 +10,7 @@ import org.alfresco.rest.model.RestProcessDefinitionModel;
import org.alfresco.rest.model.RestTaskModel;
import org.alfresco.rest.model.RestVariableModelsCollection;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.ProcessModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
import org.alfresco.utility.model.TestGroup;
@@ -553,4 +554,34 @@ public class UpdateTaskFullTestsBulk1 extends RestTest
restTaskModel.assertThat().field("state").is("resolved")
.and().field("assignee").isNull();
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify owner cannot update task after it was deleted and response is 404")
public void updateTaskAfterItWasDeleted() throws Exception
{
ProcessModel process = new ProcessModel();
process.setId(taskModel.getProcessId());
dataWorkflow.usingUser(owner).deleteProcess(process);
restTaskModel = restClient.authenticateUser(owner)
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("completed");
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
.containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, taskModel.getId()));
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify task owner cannot update task with empty input body and response is 400")
public void taskOwnerCannotUpdateTaskWithEmptyInputBody() throws Exception
{
JsonObject inputJson = JsonBodyGenerator.defineJSON().build();
restTaskModel = restClient.authenticateUser(owner)
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask(inputJson);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
.containsErrorKey(String.format(RestErrorModel.TASK_INVALID_STATE, "null"))
.containsSummary(String.format(RestErrorModel.TASK_INVALID_STATE, "null"));
}
}
@@ -88,7 +88,17 @@ public class UpdateTaskSanityTests extends RestTest
restTaskModel = restClient.authenticateUser(userModel1).withWorkflowAPI().usingTask(taskModel).updateTask("completed");
restClient.assertStatusCodeIs(HttpStatus.OK);
restTaskModel.assertThat().field("id").is(taskModel.getId())
.and().field("description").is(taskModel.getMessage());
restTaskModel.assertThat()
.field("dueAt").isNotEmpty()
.and().field("processDefinitionId").is("activitiReviewPooled:1:12")
.and().field("processId").is(taskModel.getProcessId())
.and().field("name").is("Review Task")
.and().field("description").is(taskModel.getMessage())
.and().field("startedAt").isNotEmpty()
.and().field("id").is(taskModel.getId())
.and().field("state").is("unclaimed")
.and().field("activityDefinitionId").is("reviewTask")
.and().field("priority").is(taskModel.getPriority().getLevel())
.and().field("formResourceKey").is("wf:activitiReviewTask");
}
}