test- added test cases: multiple task variables

This commit is contained in:
mionescu
2017-02-08 13:47:38 +02:00
parent 884ef0da6d
commit d687f9af6f
3 changed files with 301 additions and 10 deletions
@@ -5,6 +5,7 @@ import org.alfresco.rest.RestTest;
import org.alfresco.rest.core.RestRequest;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestVariableModel;
import org.alfresco.rest.model.RestVariableModelsCollection;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
@@ -26,7 +27,9 @@ public class AddTaskVariablesCoreTests extends RestTest
private FileModel fileModel;
private UserModel assigneeUser;
private TaskModel taskModel;
private RestVariableModel invalidVariableModel, variableModel, variableModel1;
private RestVariableModelsCollection restVariableCollection;
private String taskId;
@BeforeClass(alwaysRun = true)
@@ -47,11 +50,22 @@ public class AddTaskVariablesCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION, description = "Adding task variable is falling in case invalid variableBody is provided")
public void failedAddingTaskVariableIfInvalidBodyIsProvided() throws Exception
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("instance", "d:char");
invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("instance", "d:char");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(invalidVariableModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Illegal value for variable scope: 'instance'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Adding multiple task variable is falling in case invalid variableBody is provided")
public void failedAddingMultipleTaskVariableIfInvalidBodyIsProvided() throws Exception
{
variableModel = RestVariableModel.getRandomTaskVariableModel("instance", "d:char");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Illegal value for variable scope: 'instance'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -63,7 +77,19 @@ public class AddTaskVariablesCoreTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
.containsSummary("Variable scope is required and can only be 'local' or 'global'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Adding multiple task variable is falling in case empty body type is provided")
public void failedAddingMultipleTaskVariableIfEmptyBodyIsProvided() throws Exception
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("", "");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(invalidVariableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
.containsSummary("Variable scope is required and can only be 'local' or 'global'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -76,7 +102,6 @@ public class AddTaskVariablesCoreTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
.containsSummary("Variable scope is required and can only be 'local' or 'global'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -88,7 +113,6 @@ public class AddTaskVariablesCoreTests extends RestTest
restClient.processModel(RestVariableModel.class, request);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Variable name is required.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -97,10 +121,22 @@ public class AddTaskVariablesCoreTests extends RestTest
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:char");
taskModel.setId(taskId);
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(invalidVariableModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Unsupported type of variable: 'd:char'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Adding multiple task variable is falling in case invalid type is provided")
public void failedAddingMultipleTaskVariableIfInvalidTypeIsProvided() throws Exception
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:char");
taskModel.setId(taskId);
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(invalidVariableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Unsupported type of variable: 'd:char'.");
}
@Bug(id = "ACE-5674")
@@ -110,10 +146,24 @@ public class AddTaskVariablesCoreTests extends RestTest
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("local", "ddm:text");
taskModel.setId(taskId);
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(invalidVariableModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Namespace prefix ddm is not mapped to a namespace URI");
}
@Bug(id = "ACE-5674")
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Adding multiple task variable is falling in case invalid type prefix is provided")
public void failedAddingMultipleTaskVariableIfInvalidTypePrefixIsProvided() throws Exception
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("local", "ddm:text");
taskModel.setId(taskId);
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(invalidVariableModel,variableModel1, variableModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Namespace prefix ddm is not mapped to a namespace URI");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -122,10 +172,23 @@ public class AddTaskVariablesCoreTests extends RestTest
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("instance", "d:text");
taskModel.setId(taskId);
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(invalidVariableModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Illegal value for variable scope: 'instance'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Adding multiple task variable is falling in case invalid scope is provided")
public void failedAddingMultipleTaskVariableIfInvalidScopeIsProvided() throws Exception
{
RestVariableModel invalidVariableModel = RestVariableModel.getRandomTaskVariableModel("instance", "d:text");
taskModel.setId(taskId);
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(invalidVariableModel, variableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Illegal value for variable scope: 'instance'.");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -138,7 +201,20 @@ public class AddTaskVariablesCoreTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, taskModel.getId()));
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Adding multiple task variable is falling in case invalid task id is provided")
public void failedAddingMultipleTaskVariableIfInvalidTaskIdIsProvided() throws Exception
{
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
taskModel.setId(taskModel.getId() + "TEST");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, taskModel.getId()));
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -149,7 +225,19 @@ public class AddTaskVariablesCoreTests extends RestTest
variableModel.setValue("invalidValue");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("For input string: \"invalidValue\"");
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Adding multiple task variable is falling in case invalid task id is provided")
public void failedAddingMultipleTaskVariableIfInvalidValueIsProvided() throws Exception
{
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:int");
variableModel.setValue("invalidValue");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("For input string: \"invalidValue\"");
}
}
@@ -7,6 +7,7 @@ import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.rest.model.RestTaskModel;
import org.alfresco.rest.model.RestVariableModel;
import org.alfresco.rest.model.RestVariableModelsCollection;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
@@ -26,7 +27,8 @@ public class AddTaskVariablesFullTests extends RestTest
private FileModel fileModel;
private UserModel assigneeUser;
private TaskModel taskModel;
private RestVariableModel restVariablemodel;
private RestVariableModel restVariablemodel, variableModel, variableModel1;
private RestVariableModelsCollection restVariableCollection;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
@@ -57,6 +59,32 @@ public class AddTaskVariablesFullTests extends RestTest
.and().field("type").is(variableModel.getType());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Create multiple task variable with name containing symbols")
public void createMultipleTaskVariableWithSymbolsInName() throws Exception
{
UserModel adminUser = dataUser.getAdminUser();
restClient.authenticateUser(adminUser);
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel.setName("!@#$%^&*({}<>.,;'=_|");
restVariableCollection = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel,variableModel1);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restVariableCollection.getEntries().get(0).onModel().assertThat()
.field("scope").is(variableModel.getScope())
.and().field("name").is(variableModel.getName())
.and().field("value").is(variableModel.getValue())
.and().field("type").is(variableModel.getType());
restVariableCollection.getEntries().get(1).onModel().assertThat()
.field("scope").is(variableModel1.getScope())
.and().field("name").is(variableModel1.getName())
.and().field("value").is(variableModel1.getValue())
.and().field("type").is(variableModel1.getType());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Create task variable with empty name")
@@ -74,6 +102,25 @@ public class AddTaskVariablesFullTests extends RestTest
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Create task variable with empty name")
public void failledCreatingMultipleTaskVariableWithEmptyName() throws Exception
{
UserModel adminUser = dataUser.getAdminUser();
restClient.authenticateUser(adminUser);
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
variableModel.setName("");
restVariableCollection = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
.assertLastError().containsErrorKey(RestErrorModel.VARIABLE_NAME_REQUIRED)
.containsSummary(RestErrorModel.VARIABLE_NAME_REQUIRED)
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify that admin from the same network is able to add task variables")
@@ -100,6 +147,40 @@ public class AddTaskVariablesFullTests extends RestTest
.and().field("type").is(variableModel.getType());
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify that admin from the same network is able to add multiple task variables")
public void addMultipleTaskVariablesByTenantAdmin() throws Exception
{
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser1);
UserModel tenantUser1 = dataUser.usingUser(adminTenantUser1).createUserWithTenant("uTenant1");
RestProcessModel networkProcess1 = restClient.authenticateUser(tenantUser1).withWorkflowAPI()
.addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
RestTaskModel task = restClient.authenticateUser(adminTenantUser1)
.withWorkflowAPI().usingProcess(networkProcess1).getProcessTasks().getOneRandomEntry();
restClient.authenticateUser(adminTenantUser1);
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restVariableCollection = restClient.withWorkflowAPI().usingTask(task.onModel())
.addTaskVariables(variableModel, variableModel1);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restVariableCollection.getEntries().get(0).onModel().assertThat()
.field("scope").is(variableModel.getScope())
.and().field("name").is(variableModel.getName())
.and().field("value").is(variableModel.getValue())
.and().field("type").is(variableModel.getType());
restVariableCollection.getEntries().get(1).onModel().assertThat()
.field("scope").is(variableModel1.getScope())
.and().field("name").is(variableModel1.getName())
.and().field("value").is(variableModel1.getValue())
.and().field("type").is(variableModel1.getType());
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify that admin from another network is not able to add task variables")
@@ -126,4 +207,33 @@ public class AddTaskVariablesFullTests extends RestTest
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Verify that admin from another network is not able to add multiple task variables")
public void addMultipleTaskVariablesByTenantFromAnotherNetwork() throws Exception
{
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
UserModel adminTenantUser2 = UserModel.getAdminTenantUser();
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser1);
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser2);
UserModel tenantUser1 = dataUser.usingUser(adminTenantUser1).createUserWithTenant("uTenant1");
RestProcessModel networkProcess1 = restClient.authenticateUser(tenantUser1).withWorkflowAPI()
.addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
RestTaskModel task = restClient.authenticateUser(adminTenantUser1)
.withWorkflowAPI().usingProcess(networkProcess1).getProcessTasks().getOneRandomEntry();
restClient.authenticateUser(adminTenantUser1);
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restVariableCollection = restClient.authenticateUser(adminTenantUser2).withWorkflowAPI()
.usingTask(task.onModel())
.addTaskVariables(variableModel,variableModel1);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
}
@@ -3,6 +3,7 @@ package org.alfresco.rest.workflow.tasks;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestVariableModel;
import org.alfresco.rest.model.RestVariableModelsCollection;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
@@ -26,6 +27,8 @@ public class AddTaskVariablesSanityTests extends RestTest
private UserModel assigneeUser;
private TaskModel taskModel;
private RestVariableModel restVariablemodel;
private RestVariableModelsCollection restVariableCollection;
private RestVariableModel variableModel, variableModel1;
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
@@ -55,6 +58,32 @@ public class AddTaskVariablesSanityTests extends RestTest
.and().field("value").is(variableModel.getValue())
.and().field("type").is(variableModel.getType());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
description = "Create non-existing task variable with admin")
public void createMultipleTaskVariablesWithAdmin() throws Exception
{
UserModel adminUser = dataUser.getAdminUser();
restClient.authenticateUser(adminUser);
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restVariableCollection = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel,variableModel1);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restVariableCollection.getEntries().get(0).onModel().assertThat()
.field("scope").is(variableModel.getScope())
.and().field("name").is(variableModel.getName())
.and().field("value").is(variableModel.getValue())
.and().field("type").is(variableModel.getType());
restVariableCollection.getEntries().get(1).onModel().assertThat()
.field("scope").is(variableModel1.getScope())
.and().field("name").is(variableModel1.getName())
.and().field("value").is(variableModel1.getValue())
.and().field("type").is(variableModel1.getType());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
@@ -73,6 +102,31 @@ public class AddTaskVariablesSanityTests extends RestTest
restClient.withWorkflowAPI().usingTask(taskModel).getTaskVariables().assertThat().entriesListContains("name", variableModel.getName());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
description = "Create multiple non-existing task variable with involved user")
public void createMultipleTaskVariableWithInvolvedUser() throws Exception
{
restClient.authenticateUser(assigneeUser);
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restVariableCollection = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel,variableModel1);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restVariableCollection.getEntries().get(0).onModel().assertThat()
.field("scope").is(variableModel.getScope())
.and().field("name").is(variableModel.getName())
.and().field("value").is(variableModel.getValue())
.and().field("type").is(variableModel.getType());
restVariableCollection.getEntries().get(1).onModel().assertThat()
.field("scope").is(variableModel1.getScope())
.and().field("name").is(variableModel1.getName())
.and().field("value").is(variableModel1.getValue())
.and().field("type").is(variableModel1.getType());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
@@ -89,6 +143,31 @@ public class AddTaskVariablesSanityTests extends RestTest
.and().field("value").is(variableModel.getValue())
.and().field("type").is(variableModel.getType());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
description = "Create multiple non-existing task variable with task owner")
public void createMultipleTaskVariableWithTaskOwner() throws Exception
{
restClient.authenticateUser(userWhoStartsTask);
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restVariableCollection = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel,variableModel1);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restVariableCollection.getEntries().get(0).onModel().assertThat()
.field("scope").is(variableModel.getScope())
.and().field("name").is(variableModel.getName())
.and().field("value").is(variableModel.getValue())
.and().field("type").is(variableModel.getType());
restVariableCollection.getEntries().get(1).onModel().assertThat()
.field("scope").is(variableModel1.getScope())
.and().field("name").is(variableModel1.getName())
.and().field("value").is(variableModel1.getValue())
.and().field("type").is(variableModel1.getType());
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
@@ -102,4 +181,18 @@ public class AddTaskVariablesSanityTests extends RestTest
restVariablemodel = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("Permission was denied");
}
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
description = "Create multiple non-existing task variable with any user")
public void createMultipleTaskVariableWithRandomUser() throws Exception
{
restClient.authenticateUser(userModel);
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
variableModel1 = RestVariableModel.getRandomTaskVariableModel("global", "d:text");
restVariableCollection = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariables(variableModel,variableModel1);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("Permission was denied");
}
}