update tests based on new refactored DSL

This commit is contained in:
cagache
2016-11-16 17:47:07 +02:00
parent 648ebc33ac
commit 2f13480083
@@ -1,15 +1,14 @@
package org.alfresco.rest.workflow.deployments;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestDeploymentModel;
import org.alfresco.rest.requests.RestDeploymentsApi;
import org.alfresco.rest.model.RestDeploymentModelsCollection;
import org.alfresco.utility.model.ErrorModel;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.Bug;
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;
@@ -23,11 +22,8 @@ import org.testng.annotations.Test;
*/
@Test(groups = { TestGroup.REST_API, TestGroup.DEPLOYMENTS, TestGroup.SANITY, TestGroup.WORKFLOW }, priority = 100)
public class DeleteDeploymentSanityTests extends RestWorkflowTest
public class DeleteDeploymentSanityTests extends RestTest
{
@Autowired
private RestDeploymentsApi deploymentsApi;
private UserModel adminUser;
private RestDeploymentModel deployment;
@@ -35,35 +31,33 @@ public class DeleteDeploymentSanityTests extends RestWorkflowTest
public void dataPreparation() throws Exception
{
adminUser = dataUser.getAdminUser();
deploymentsApi.useRestClient(restClient);
}
@Bug(id = "MNT-16996")
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
@Bug(id = "MNT-16996")
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
executionType = ExecutionType.SANITY, description = "Verify admin user deletes a specific deployment using REST API and status code is successful (204)")
public void adminDeletesDeploymentWithSuccess() throws JsonToModelConversionException, Exception
public void adminDeletesDeploymentWithSuccess() throws Exception
{
dataContent.assertExtensionAmpExists("alfresco-workflow-extension");
restClient.authenticateUser(adminUser);
// The deployment with name "customWorkflowExtentionForRest.bpmn" is created by Workflow Extention Point
deploymentsApi.getDeployments().assertThat()
.entriesListContains("name", "customWorkflowExtentionForRest.bpmn");
deployment = deploymentsApi.getDeployments().getDeploymentByName("customWorkflowExtentionForRest.bpmn");
deploymentsApi.deleteDeployment(deployment);
deploymentsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@Bug(id = "MNT-16996")
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
executionType = ExecutionType.SANITY, description = "Verify admin user cannot delete an inexistent deployment using REST API and status code is successful (204)")
public void adminCannotDeleteInexistentDeployment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUser);
deployment = deploymentsApi.getDeployments().getOneRandomEntry();
deployment.onModel().setId(String.valueOf(1000));
RestDeploymentModelsCollection allDeployments = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments();
allDeployments.assertThat().entriesListContains("name", "customWorkflowExtentionForRest.bpmn");
deployment = allDeployments.getDeploymentByName("customWorkflowExtentionForRest.bpmn");
deploymentsApi.deleteDeployment(deployment);
deploymentsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
restClient.withWorkflowAPI().usingDeployment(deployment).deleteDeployment();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@Bug(id = "MNT-16996")
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
executionType = ExecutionType.SANITY, description = "Verify admin user cannot delete an inexistent deployment using REST API and status code is successful (204)")
public void adminCannotDeleteInexistentDeployment() throws Exception
{
deployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel();
deployment.setId(String.valueOf(1000));
restClient.withWorkflowAPI().usingDeployment(deployment).deleteDeployment();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, "1000"));
}
}