test: updates after review

core: added new error message in rest/model/RestErrorModel.java
This commit is contained in:
mionescu
2016-12-09 15:56:23 +02:00
parent 30430e3f62
commit 08aaf4ea35
2 changed files with 9 additions and 21 deletions
@@ -57,16 +57,13 @@ public class AddProcessItemCoreTests extends RestTest
public void addProcessItemByAnyUser() throws Exception
{
anotherUser = dataUser.createRandomTestUser();
siteModel = dataSite.usingUser(anotherUser).createPublicRandomSite();
processModel = restClient.authenticateUser(anotherUser).withWorkflowAPI().addProcess("activitiAdhoc", anotherUser, false, Priority.Normal);
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
processItem = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processItem.assertThat().field("createdAt").isNotEmpty().and().field("size").is("19").and().field("createdBy").is(adminUser.getUsername()).and()
.field("modifiedAt").isNotEmpty().and().field("name").is(document2.getName()).and().field("modifiedBy").is(anotherUser.getUsername()).and()
.field("id").is(document2.getNodeRefWithoutVersion()).and().field("mimeType").is(document2.getFileType().mimeType);
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processItem = restClient.authenticateUser(anotherUser).withWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError()
.containsSummary(String.format(RestErrorModel.ACCESS_INFORMATION_NOT_ALLOWED, processModel.getId()));
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE, TestGroup.NETWORKS })
@@ -40,7 +40,7 @@ public class AddTaskItemCoreTests extends RestTest
assigneeUser = dataUser.createRandomTestUser();
taskModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
taskId = taskModel.getId();
taskId = taskModel.getId();
}
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@@ -48,18 +48,9 @@ public class AddTaskItemCoreTests extends RestTest
public void addTaskItemByRandomUser() throws JsonToModelConversionException, Exception
{
anotherUser = dataUser.createRandomTestUser();
restClient.authenticateUser(anotherUser);
siteModel = dataSite.usingUser(anotherUser).createPublicRandomSite();
document = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
taskModel = dataWorkflow.usingUser(anotherUser).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(anotherUser);
taskItem = restClient.withWorkflowAPI().usingTask(taskModel).addTaskItem(document);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
taskItem = restClient.authenticateUser(anotherUser).withWorkflowAPI().usingTask(taskModel).addTaskItem(fileModel);
taskItem.assertThat().field("createdAt").isNotEmpty().and().field("size").isNotEmpty().and().field("createdBy").is(adminUser.getUsername()).and()
.field("modifiedAt").isNotEmpty().and().field("name").is(document.getName()).and().field("modifiedBy").is(anotherUser.getUsername()).and()
.field("id").is(document.getNodeRefWithoutVersion()).and().field("mimeType").is(document.getFileType().mimeType);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@Bug(id = "ACE-5683")
@@ -77,7 +68,7 @@ public class AddTaskItemCoreTests extends RestTest
@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 task item is falling in case empty item body is provided")
public void failedAddingTaskItemIfEmptyItemBodyIsProvided() throws Exception
{
{
fileModel.setNodeRef("");
taskItem = restClient.authenticateUser(userModel).withWorkflowAPI().usingTask(taskModel).addTaskItem(fileModel);