test: added withParams("maxItems=2") to limit the returned results

This commit is contained in:
Paul Brodner
2016-12-11 16:21:52 +02:00
parent 0868b4c8bd
commit cda83aa928
3 changed files with 8 additions and 8 deletions
@@ -59,7 +59,7 @@ public class AddProcessItemCoreTests extends RestTest
anotherUser = dataUser.createRandomTestUser();
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel = restClient.authenticateUser(adminUser).withParams("maxItems=1").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processItem = restClient.authenticateUser(anotherUser).withWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError()
@@ -111,7 +111,7 @@ public class AddProcessItemCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION, description = "Adding process item is falling in case of invalid process id is provided")
public void failedAddingProcessItemIfInvalidProcessIdIsProvided() throws Exception
{
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel = restClient.authenticateUser(adminUser).withParams("maxItems=1").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel.setId("invalidProcessId");
processItem = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(document);
@@ -37,7 +37,7 @@ public class GetProcessItemsCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
public void getProcessItemsAsAdminReturnsAnything() throws Exception
{
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel = restClient.authenticateUser(adminUser).withParams("maxItems=2").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
restClient.withWorkflowAPI().usingProcess(processModel).getProcessItems().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -77,10 +77,10 @@ public class GetProcessVariablesCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
public void getProcessVariablesUsingInvalidProcessId() throws JsonToModelConversionException, Exception
{
processModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel = restClient.authenticateUser(userWhoStartsTask).withParams("maxItems=2").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
String id = RandomStringUtils.randomAlphanumeric(10);
processModel.setId(id);
variables = restClient.withWorkflowAPI().usingProcess(processModel).getProcessVariables();
variables = restClient.withParams("maxItems=2").withWorkflowAPI().usingProcess(processModel).getProcessVariables();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, id));
}
@@ -89,7 +89,7 @@ public class GetProcessVariablesCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
public void getProcessVariablesUsingEmptyProcessId() throws JsonToModelConversionException, Exception
{
processModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel = restClient.authenticateUser(userWhoStartsTask).withParams("maxItems=2").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel.setId(" ");
variables = restClient.withWorkflowAPI().usingProcess(processModel).getProcessVariables();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, " "));
@@ -100,11 +100,11 @@ public class GetProcessVariablesCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
public void getProcessVariablesForADeletedProcess() throws JsonToModelConversionException, Exception
{
processModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel = restClient.authenticateUser(userWhoStartsTask).withParams("maxItems=2").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
restClient.authenticateUser(admin).withWorkflowAPI().usingProcess(processModel).deleteProcess();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.authenticateUser(admin).withWorkflowAPI().usingProcess(processModel).getProcess();
restClient.authenticateUser(admin).withParams("maxItems=2").withWorkflowAPI().usingProcess(processModel).getProcess();
variables = restClient.authenticateUser(admin).withWorkflowAPI().usingProcess(processModel).getProcessVariables();
restClient.assertStatusCodeIs(HttpStatus.OK);