update tests based on new refactored DSL

This commit is contained in:
cagache
2016-11-16 11:26:09 +02:00
parent 7165ffce53
commit 91e2622277
@@ -4,16 +4,13 @@ import org.alfresco.dataprep.CMISUtil.Priority;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.rest.requests.Processes;
import org.alfresco.rest.requests.RestTenantApi;
import org.alfresco.utility.data.DataUser;
import org.alfresco.rest.model.RestProcessModelsCollection;
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;
/**
@@ -22,27 +19,10 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
public class AddProcessSanityTests extends RestWorkflowTest
{
@Autowired
private DataUser dataUser;
@Autowired
private Processes processesApi;
@Autowired
private RestTenantApi tenantApi;
private UserModel userWhoStartsProcess, assignee;
private UserModel adminTenantUser, tenantUserWhoStartsProcess, tenantAssignee;
private RestProcessModel addedProcess;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
processesApi.useRestClient(restClient);
tenantApi.useRestClient(restClient);
adminTenantUser = UserModel.getAdminTenantUser();
restClient.authenticateUser(dataUser.getAdminUser());
}
private RestProcessModelsCollection processes;
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify non network user is able to start new process using REST API and status code is OK (200)")
@@ -51,14 +31,14 @@ public class AddProcessSanityTests extends RestWorkflowTest
userWhoStartsProcess = dataUser.createRandomTestUser();
assignee = dataUser.createRandomTestUser();
restClient.authenticateUser(userWhoStartsProcess);
addedProcess = processesApi.addProcess("activitiAdhoc", assignee, false, Priority.Normal);
addedProcess = restClient.authenticateUser(userWhoStartsProcess).addProcess("activitiAdhoc", assignee, false, Priority.Normal);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
addedProcess.assertThat().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
processesApi.getProcesses().assertThat().entriesListContains("id", addedProcess.getId());
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
.and().field("startUserId").is(addedProcess.getStartUserId());
processes = restClient.getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
processes.assertThat().entriesListContains("id", addedProcess.getId());
}
@TestRail(section = { TestGroup.REST_API,
@@ -66,17 +46,19 @@ public class AddProcessSanityTests extends RestWorkflowTest
@Test(groups = { TestGroup.NETWORKS })
public void networkUserStartsNewProcess() throws JsonToModelConversionException, Exception
{
tenantApi.createTenant(adminTenantUser);
restClient.authenticateUser(adminTenantUser);
adminTenantUser = UserModel.getAdminTenantUser();
restClient.authenticateUser(dataUser.getAdminUser())
.usingTenant().createTenant(adminTenantUser);
tenantUserWhoStartsProcess = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
tenantAssignee = dataUser.usingUser(adminTenantUser).createUserWithTenant("u2Tenant");
restClient.authenticateUser(tenantUserWhoStartsProcess);
addedProcess = processesApi.addProcess("activitiAdhoc", tenantAssignee, false, Priority.Normal);
addedProcess = restClient.authenticateUser(tenantUserWhoStartsProcess).addProcess("activitiAdhoc", tenantAssignee, false, Priority.Normal);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
addedProcess.assertThat().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
processesApi.getProcesses().assertThat().entriesListContains("id", addedProcess.getId());
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
processes = restClient.getProcesses();
restClient.assertStatusCodeIs(HttpStatus.OK);
processes.assertThat().entriesListContains("id", addedProcess.getId());
}
}