Merge branch 'TAS-774' into 'master'

Tas 774

See merge request !116
This commit is contained in:
Paul Brodner
2016-10-19 18:56:49 +01:00
@@ -0,0 +1,69 @@
package org.alfresco.rest.workflow.tasks;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.model.RestVariableModel;
import org.alfresco.rest.requests.RestTasksApi;
import org.alfresco.utility.model.FileModel;
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;
/**
* @author iulia.cojocea
*/
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
public class DeleteTaskVariableSanityTests extends RestWorkflowTest
{
@Autowired
RestTasksApi tasksApi;
private UserModel userModel, adminUser;
private SiteModel siteModel;
private FileModel fileModel;
private UserModel assigneeUser;
private TaskModel taskModel;
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
adminUser = dataUser.getAdminUser();
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 = "Delete existing task variable")
public void deleteTaskVariable() throws Exception
{
restClient.authenticateUser(adminUser);
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
tasksApi.updateTaskVariable(taskModel, variableModel);
tasksApi.deleteTaskVariable(taskModel, variableModel);
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
description = "Try to delete existing task variable using invalid task id")
public void tryToDeleteTaskVariableUsingInvalidTaskId() throws Exception
{
restClient.authenticateUser(adminUser);
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
tasksApi.updateTaskVariable(taskModel, variableModel);
taskModel.setId("incorrectTaskId");
tasksApi.deleteTaskVariable(taskModel, variableModel);
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
}