mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Add assertions to REST API tests
This commit is contained in:
@@ -59,6 +59,15 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
|
||||
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processItem = processesApi.addProcessItem(processModel, document2);
|
||||
processItem.and().assertField("createdAt").is(processItem.getCreatedAt())
|
||||
.and().assertField("size").is(processItem.getSize())
|
||||
.and().assertField("createdBy").is(processItem.getCreatedBy())
|
||||
.and().assertField("modifiedAt").is(processItem.getModifiedAt())
|
||||
.and().assertField("name").is(processItem.getName())
|
||||
.and().assertField("modifiedBy").is(processItem.getModifiedBy())
|
||||
.and().assertField("id").is(processItem.getId())
|
||||
.and().assertField("mimeType").is(processItem.getMimeType());
|
||||
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcessesItems(processModel).assertEntriesListContains("id", processItem.getId());
|
||||
|
||||
@@ -73,6 +82,15 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
|
||||
document3 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processItem = processesApi.addProcessItem(processModel, document3);
|
||||
processItem.and().assertField("createdAt").is(processItem.getCreatedAt())
|
||||
.and().assertField("size").is(processItem.getSize())
|
||||
.and().assertField("createdBy").is(processItem.getCreatedBy())
|
||||
.and().assertField("modifiedAt").is(processItem.getModifiedAt())
|
||||
.and().assertField("name").is(processItem.getName())
|
||||
.and().assertField("modifiedBy").is(processItem.getModifiedBy())
|
||||
.and().assertField("id").is(processItem.getId())
|
||||
.and().assertField("mimeType").is(processItem.getMimeType());
|
||||
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcessesItems(processModel).assertEntriesListContains("id", processItem.getId());
|
||||
processItem = processesApi.addProcessItem(processModel, document3);
|
||||
|
||||
@@ -53,6 +53,10 @@ public class AddProcessSanityTests extends RestWorkflowTest
|
||||
|
||||
restClient.authenticateUser(userWhoStartsProcess);
|
||||
addedProcess = processesApi.addProcess("activitiAdhoc", assignee, false, Priority.Normal);
|
||||
addedProcess.and().assertField("id").is(addedProcess.getId())
|
||||
.and().assertField("startUserId").is(addedProcess.getStartUserId());
|
||||
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcesses().assertEntriesListContains("id", addedProcess.getId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
@@ -69,6 +73,9 @@ public class AddProcessSanityTests extends RestWorkflowTest
|
||||
|
||||
restClient.authenticateUser(tenantUserWhoStartsProcess);
|
||||
addedProcess = processesApi.addProcess("activitiAdhoc", tenantAssignee, false, Priority.Normal);
|
||||
addedProcess.and().assertField("id").is(addedProcess.getId())
|
||||
.and().assertField("startUserId").is(addedProcess.getStartUserId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcesses().assertEntriesListContains("id", addedProcess.getId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
+21
-4
@@ -40,6 +40,7 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
|
||||
private UserModel userWhoStartsTask, assignee, adminTenantUser, tenantUser, tenantUserAssignee;
|
||||
private RestProcessModel processModel;
|
||||
private UserModel adminUser;
|
||||
private RestProcessVariableModel processVariable;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -60,8 +61,14 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
RestProcessVariableModel variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.addProcessVariable(processModel, variableModel);
|
||||
|
||||
processVariable = processesApi.addProcessVariable(processModel, variableModel);
|
||||
processVariable.and().assertField("name").is(processVariable.getName())
|
||||
.and().assertField("type").is(processVariable.getType())
|
||||
.and().assertField("value").is(processVariable.getValue());
|
||||
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcessesVariables(processModel).assertEntriesListContains("name", processVariable.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
@@ -71,9 +78,15 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
RestProcessVariableModel variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.addProcessVariable(processModel, variableModel);
|
||||
variableModel.setValue(RandomData.getRandomName("newValue"));
|
||||
processesApi.addProcessVariable(processModel, variableModel);
|
||||
processVariable = processesApi.addProcessVariable(processModel, variableModel);
|
||||
processVariable.and().assertField("name").is(processVariable.getName())
|
||||
.and().assertField("type").is(processVariable.getType())
|
||||
.and().assertField("value").is(processVariable.getValue());
|
||||
|
||||
String newValue = RandomData.getRandomName("value");
|
||||
variableModel.setValue(newValue);
|
||||
processVariable = processesApi.addProcessVariable(processModel, variableModel)
|
||||
.and().assertField("value").is(newValue);
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -98,6 +111,10 @@ public class AddProcessVariableSanityTests extends RestWorkflowTest
|
||||
RestProcessVariableModel variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.addProcessVariable(processModel, variableModel);
|
||||
processVariable.and().assertField("name").is(processVariable.getName())
|
||||
.and().assertField("type").is(processVariable.getType())
|
||||
.and().assertField("value").is(processVariable.getValue());
|
||||
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,6 @@ public class DeleteProcessSanityTests extends RestWorkflowTest
|
||||
task = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
restClient.authenticateUser(anotherUser);
|
||||
processesApi.deleteProcess(task);
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("user is not allowed to access information about process");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class GetProcessItemsSanityTests extends RestWorkflowTest
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.getProcessesItems(processModel);
|
||||
processesApi.getProcessesItems(processModel).assertEntriesListIsNotEmpty();
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class GetProcessItemsSanityTests extends RestWorkflowTest
|
||||
{
|
||||
restClient.authenticateUser(assignee);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.getProcessesItems(processModel);
|
||||
processesApi.getProcessesItems(processModel).assertEntriesListIsNotEmpty();
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class GetProcessItemsSanityTests extends RestWorkflowTest
|
||||
dataWorkflow.usingUser(tenantUser).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(tenantUserAssignee);
|
||||
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.getProcessesItems(processModel);
|
||||
processesApi.getProcessesItems(processModel).assertEntriesListIsNotEmpty();
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ public class GetProcessSanityTests extends RestWorkflowTest
|
||||
public void getProcessByOwner() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsProcess);
|
||||
processesApi.getProcess(addedProcess);
|
||||
processesApi.getProcess(addedProcess).and().assertField("id").is(addedProcess.getId())
|
||||
.and().assertField("startUserId").is(addedProcess.getStartUserId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -53,7 +54,8 @@ public class GetProcessSanityTests extends RestWorkflowTest
|
||||
public void getProcessByAssignee() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(assignee);
|
||||
processesApi.getProcess(addedProcess);
|
||||
processesApi.getProcess(addedProcess).and().assertField("id").is(addedProcess.getId())
|
||||
.and().assertField("startUserId").is(addedProcess.getStartUserId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -62,7 +64,8 @@ public class GetProcessSanityTests extends RestWorkflowTest
|
||||
public void getProcessByAdmin() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.getAdminUser());
|
||||
processesApi.getProcess(addedProcess);
|
||||
processesApi.getProcess(addedProcess).and().assertField("id").is(addedProcess.getId())
|
||||
.and().assertField("startUserId").is(addedProcess.getStartUserId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ public class GetProcessesVariablesSanityTests extends RestWorkflowTest
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.getProcessesVariables(processModel);
|
||||
processesApi.getProcessesVariables(processModel).assertEntriesListIsNotEmpty();
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class GetProcessesVariablesSanityTests extends RestWorkflowTest
|
||||
{
|
||||
restClient.authenticateUser(assignee);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.getProcessesVariables(processModel);
|
||||
processesApi.getProcessesVariables(processModel).assertEntriesListIsNotEmpty();
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,14 +58,15 @@ public class AddTaskItemSanityTests extends RestWorkflowTest
|
||||
taskItem = tasksApi.addTaskItem(taskModel, document2);
|
||||
|
||||
taskItem.and().assertField("createdAt").is(taskItem.getCreatedAt())
|
||||
.and().assertField("size").is(taskItem.getSize())
|
||||
.and().assertField("createdBy").is(taskItem.getCreatedBy())
|
||||
.and().assertField("modifiedAt").is(taskItem.getModifiedAt())
|
||||
.and().assertField("name").is(taskItem.getName())
|
||||
.and().assertField("modifiedBy").is(taskItem.getModifiedBy())
|
||||
.and().assertField("id").is(taskItem.getId())
|
||||
.and().assertField("mimeType").is(taskItem.getMimeType());
|
||||
.and().assertField("size").is(taskItem.getSize())
|
||||
.and().assertField("createdBy").is(taskItem.getCreatedBy())
|
||||
.and().assertField("modifiedAt").is(taskItem.getModifiedAt())
|
||||
.and().assertField("name").is(taskItem.getName())
|
||||
.and().assertField("modifiedBy").is(taskItem.getModifiedBy())
|
||||
.and().assertField("id").is(taskItem.getId())
|
||||
.and().assertField("mimeType").is(taskItem.getMimeType());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
tasksApi.getTaskItems(taskModel).assertEntriesListContains("id", taskItem.getId());
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16966")
|
||||
@@ -78,13 +79,13 @@ public class AddTaskItemSanityTests extends RestWorkflowTest
|
||||
document3 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
taskItem = tasksApi.addTaskItem(taskModel, document3);
|
||||
taskItem.and().assertField("createdAt").is(taskItem.getCreatedAt())
|
||||
.and().assertField("size").is(taskItem.getSize())
|
||||
.and().assertField("createdBy").is(taskItem.getCreatedBy())
|
||||
.and().assertField("modifiedAt").is(taskItem.getModifiedAt())
|
||||
.and().assertField("name").is(taskItem.getName())
|
||||
.and().assertField("modifiedBy").is(taskItem.getModifiedBy())
|
||||
.and().assertField("id").is(taskItem.getId())
|
||||
.and().assertField("mimeType").is(taskItem.getMimeType());
|
||||
.and().assertField("size").is(taskItem.getSize())
|
||||
.and().assertField("createdBy").is(taskItem.getCreatedBy())
|
||||
.and().assertField("modifiedAt").is(taskItem.getModifiedAt())
|
||||
.and().assertField("name").is(taskItem.getName())
|
||||
.and().assertField("modifiedBy").is(taskItem.getModifiedBy())
|
||||
.and().assertField("id").is(taskItem.getId())
|
||||
.and().assertField("mimeType").is(taskItem.getMimeType());
|
||||
taskItem = tasksApi.addTaskItem(taskModel, document3);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@@ -109,6 +110,14 @@ public class AddTaskItemSanityTests extends RestWorkflowTest
|
||||
|
||||
document4 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
taskItem = tasksApi.addTaskItem(taskModel, document4);
|
||||
taskItem.and().assertField("createdAt").is(taskItem.getCreatedAt())
|
||||
.and().assertField("size").is(taskItem.getSize())
|
||||
.and().assertField("createdBy").is(taskItem.getCreatedBy())
|
||||
.and().assertField("modifiedAt").is(taskItem.getModifiedAt())
|
||||
.and().assertField("name").is(taskItem.getName())
|
||||
.and().assertField("modifiedBy").is(taskItem.getModifiedBy())
|
||||
.and().assertField("id").is(taskItem.getId())
|
||||
.and().assertField("mimeType").is(taskItem.getMimeType());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,12 @@ public class AddTaskVariablesSanityTests extends RestWorkflowTest
|
||||
restClient.authenticateUser(adminUser);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.addTaskVariable(taskModel, variableModel)
|
||||
.and().assertField("scope").is(variableModel.getScope())
|
||||
.and().assertField("name").is(variableModel.getName())
|
||||
.and().assertField("value").is(variableModel.getValue())
|
||||
.and().assertField("type").is(variableModel.getType());
|
||||
.and().assertField("scope").is(variableModel.getScope())
|
||||
.and().assertField("name").is(variableModel.getName())
|
||||
.and().assertField("value").is(variableModel.getValue())
|
||||
.and().assertField("type").is(variableModel.getType());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
tasksApi.getTaskVariables(taskModel).assertEntriesListContains("name", variableModel.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
@@ -66,11 +67,12 @@ public class AddTaskVariablesSanityTests extends RestWorkflowTest
|
||||
restClient.authenticateUser(assigneeUser);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.addTaskVariable(taskModel, variableModel)
|
||||
.and().assertField("scope").is(variableModel.getScope())
|
||||
.and().assertField("name").is(variableModel.getName())
|
||||
.and().assertField("value").is(variableModel.getValue())
|
||||
.and().assertField("type").is(variableModel.getType());
|
||||
.and().assertField("scope").is(variableModel.getScope())
|
||||
.and().assertField("name").is(variableModel.getName())
|
||||
.and().assertField("value").is(variableModel.getValue())
|
||||
.and().assertField("type").is(variableModel.getType());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
tasksApi.getTaskVariables(taskModel).assertEntriesListContains("name", variableModel.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
@@ -80,11 +82,12 @@ public class AddTaskVariablesSanityTests extends RestWorkflowTest
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.addTaskVariable(taskModel, variableModel)
|
||||
.and().assertField("scope").is(variableModel.getScope())
|
||||
.and().assertField("name").is(variableModel.getName())
|
||||
.and().assertField("value").is(variableModel.getValue())
|
||||
.and().assertField("type").is(variableModel.getType());
|
||||
.and().assertField("scope").is(variableModel.getScope())
|
||||
.and().assertField("name").is(variableModel.getName())
|
||||
.and().assertField("value").is(variableModel.getValue())
|
||||
.and().assertField("type").is(variableModel.getType());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
tasksApi.getTaskVariables(taskModel).assertEntriesListContains("name", variableModel.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
@@ -95,6 +98,6 @@ public class AddTaskVariablesSanityTests extends RestWorkflowTest
|
||||
restClient.authenticateUser(userModel);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.addTaskVariable(taskModel, variableModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("Permission was denied");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,10 @@ public class DeleteTaskVariableSanityTests extends RestWorkflowTest
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.updateTaskVariable(taskModel, variableModel);
|
||||
tasksApi.addTaskVariable(taskModel, variableModel);
|
||||
tasksApi.deleteTaskVariable(taskModel, variableModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
tasksApi.getTaskVariables(taskModel).assertEntriesListDoesNotContain("name", variableModel.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
|
||||
@@ -47,7 +47,9 @@ public class GetTaskSanityTests extends RestWorkflowTest
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
tasksApi.getTask(taskModel);
|
||||
tasksApi.getTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -55,7 +57,9 @@ public class GetTaskSanityTests extends RestWorkflowTest
|
||||
public void assigneeUserGetsItsTaskWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(assigneeUser);
|
||||
tasksApi.getTask(taskModel);
|
||||
tasksApi.getTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -63,7 +67,9 @@ public class GetTaskSanityTests extends RestWorkflowTest
|
||||
public void starterUserGetsItsTaskWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
tasksApi.getTask(taskModel);
|
||||
tasksApi.getTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -74,7 +80,7 @@ public class GetTaskSanityTests extends RestWorkflowTest
|
||||
|
||||
restClient.authenticateUser(anyUser);
|
||||
tasksApi.getTask(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("Permission was denied");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY, description = "Verify candidate user gets its specific task and no other user claimed the task with Rest API and response is successfull (200)")
|
||||
@@ -87,7 +93,9 @@ public class GetTaskSanityTests extends RestWorkflowTest
|
||||
TaskModel taskModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(fileModel).createPooledReviewTaskAndAssignTo(group);
|
||||
|
||||
restClient.authenticateUser(userModel1);
|
||||
tasksApi.getTask(taskModel);
|
||||
tasksApi.getTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -103,7 +111,9 @@ public class GetTaskSanityTests extends RestWorkflowTest
|
||||
dataWorkflow.usingUser(userModel1).claimTask(taskModel);
|
||||
|
||||
restClient.authenticateUser(userModel2);
|
||||
tasksApi.getTask(taskModel);
|
||||
tasksApi.getTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GetTaskVariablesSanityTests extends RestWorkflowTest
|
||||
public void getTaskVariablesByUserWhoStartedProcess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
tasksApi.getTaskVariables(taskModel);
|
||||
tasksApi.getTaskVariables(taskModel).assertEntriesListIsNotEmpty();
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class GetTaskVariablesSanityTests extends RestWorkflowTest
|
||||
public void getTaskVariablesByUserInvolvedInProcess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(assignee);
|
||||
tasksApi.getTaskVariables(taskModel);
|
||||
tasksApi.getTaskVariables(taskModel).assertEntriesListIsNotEmpty();
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class GetTaskVariablesSanityTests extends RestWorkflowTest
|
||||
|
||||
restClient.authenticateUser(randomUser);
|
||||
tasksApi.getTaskVariables(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("Permission was denied");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
@@ -78,7 +78,7 @@ public class GetTaskVariablesSanityTests extends RestWorkflowTest
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
|
||||
restClient.authenticateUser(adminUser);
|
||||
tasksApi.getTaskVariables(taskModel);
|
||||
tasksApi.getTaskVariables(taskModel).assertEntriesListIsNotEmpty();
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,11 @@ public class RemoveTaskItemSanityTests extends RestWorkflowTest
|
||||
taskItem = tasksApi.addTaskItem(taskModel, document2);
|
||||
tasksApi.deleteTaskItem(taskModel, taskItem);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
tasksApi.getTaskItems(taskModel).assertEntriesListDoesNotContain("id", taskItem.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Try to D=delete existing task item using invalid taskId")
|
||||
description = "Try to Delete existing task item using invalid taskId")
|
||||
public void deleteTaskItemUsingInvalidTaskId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
|
||||
@@ -38,6 +38,8 @@ public class UpdateTaskVariableSanityTests extends RestWorkflowTest
|
||||
|
||||
private UserModel adminTenantUser, tenantUser, tenantUserAssignee;
|
||||
|
||||
private RestVariableModel taskVariable;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
@@ -57,7 +59,11 @@ public class UpdateTaskVariableSanityTests extends RestWorkflowTest
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.updateTaskVariable(taskModel, variableModel);
|
||||
taskVariable = tasksApi.updateTaskVariable(taskModel, variableModel);
|
||||
taskVariable.and().assertField("scope").is(taskVariable.getScope())
|
||||
.and().assertField("name").is(taskVariable.getName())
|
||||
.and().assertField("type").is(taskVariable.getType())
|
||||
.and().assertField("value").is(taskVariable.getValue());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -68,9 +74,13 @@ public class UpdateTaskVariableSanityTests extends RestWorkflowTest
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.updateTaskVariable(taskModel, variableModel);
|
||||
taskVariable = tasksApi.updateTaskVariable(taskModel, variableModel);
|
||||
taskVariable.and().assertField("scope").is(taskVariable.getScope())
|
||||
.and().assertField("name").is(taskVariable.getName())
|
||||
.and().assertField("type").is(taskVariable.getType())
|
||||
.and().assertField("value").is(taskVariable.getValue());
|
||||
variableModel.setValue("updatedValue");
|
||||
tasksApi.updateTaskVariable(taskModel, variableModel).assertTaskVariableHasValue("updatedValue");
|
||||
taskVariable = tasksApi.updateTaskVariable(taskModel, variableModel).and().assertField("value").is("updatedValue");
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -93,9 +103,15 @@ public class UpdateTaskVariableSanityTests extends RestWorkflowTest
|
||||
tenantTask = dataWorkflow.usingUser(tenantUser).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(tenantUserAssignee);
|
||||
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
tasksApi.updateTaskVariable(tenantTask, variableModel);
|
||||
taskVariable = tasksApi.updateTaskVariable(tenantTask, variableModel);
|
||||
|
||||
taskVariable.and().assertField("scope").is(taskVariable.getScope())
|
||||
.and().assertField("name").is(taskVariable.getName())
|
||||
.and().assertField("type").is(taskVariable.getType())
|
||||
.and().assertField("value").is(taskVariable.getValue());
|
||||
|
||||
variableModel.setValue("updatedValue");
|
||||
tasksApi.updateTaskVariable(taskModel, variableModel).assertTaskVariableHasValue("updatedValue");
|
||||
taskVariable = tasksApi.updateTaskVariable(taskModel, variableModel).and().assertField("value").is("updatedValue");
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,9 @@ public class UploadTaskSanityTests extends RestWorkflowTest
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.updateTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -54,7 +56,9 @@ public class UploadTaskSanityTests extends RestWorkflowTest
|
||||
public void assigneeUserUpdatesItsTaskWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(assigneeUser);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.updateTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -73,7 +77,7 @@ public class UploadTaskSanityTests extends RestWorkflowTest
|
||||
|
||||
restClient.authenticateUser(anyUser);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary("Permission was denied");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.SANITY, description = "Verify candidate user updates its specific task and no other user claimed the task with Rest API and response is successfull (200)")
|
||||
@@ -86,7 +90,9 @@ public class UploadTaskSanityTests extends RestWorkflowTest
|
||||
TaskModel taskModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(fileModel).createPooledReviewTaskAndAssignTo(group);
|
||||
|
||||
restClient.authenticateUser(userModel1);
|
||||
tasksApi.updateTask(taskModel);
|
||||
tasksApi.updateTask(taskModel)
|
||||
.and().assertField("id").is(taskModel.getId())
|
||||
.and().assertField("message").is(taskModel.getMessage());
|
||||
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user