From fbb9dfe0d4f20082e475c0c855fca9a8aaebf12d Mon Sep 17 00:00:00 2001 From: cagache Date: Wed, 11 Oct 2017 09:56:48 +0300 Subject: [PATCH] REPO-2755 / REPO-2251: compacted DeleteDeployment classes --- .../DeleteDeploymentCoreFullTests.java | 52 ------------------- ...yTests.java => DeleteDeploymentTests.java} | 30 ++++++++++- 2 files changed, 28 insertions(+), 54 deletions(-) delete mode 100644 e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentCoreFullTests.java rename e2e-test/java/org/alfresco/rest/workflow/deployments/{DeleteDeploymentSanityTests.java => DeleteDeploymentTests.java} (77%) diff --git a/e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentCoreFullTests.java b/e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentCoreFullTests.java deleted file mode 100644 index cee3854cf..000000000 --- a/e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentCoreFullTests.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.alfresco.rest.workflow.deployments; - -import org.alfresco.rest.RestTest; -import org.alfresco.rest.model.RestDeploymentModel; -import org.alfresco.rest.model.RestErrorModel; -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.http.HttpStatus; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class DeleteDeploymentCoreFullTests extends RestTest -{ - private UserModel adminUser; - private UserModel userModel; - private RestDeploymentModel deployment; - - @BeforeClass(alwaysRun = true) - public void dataPreparation() throws Exception - { - adminUser = dataUser.getAdminUser(); - userModel = dataUser.createRandomTestUser(); - } - - @Bug(id = "MNT-16996") - @TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.REGRESSION, - description = "Verify deleteDeployment is unsupported for empty deployment id with REST API and status code is 404") - @Test(groups = { TestGroup.REST_API, TestGroup.DEPLOYMENTS, TestGroup.REGRESSION, TestGroup.WORKFLOW }) - public void deleteDeploymentIsUnsupportedForEmptyId() throws Exception - { - deployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel(); - deployment.setId(""); - restClient.withWorkflowAPI().usingDeployment(deployment).deleteDeployment(); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) - .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "")); - } - - @Bug(id = "MNT-16996") - @TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.REGRESSION, - description = "Verify deleteDeployment is forbidden using non admin user or different user than creator with REST API and status code is 403") - @Test(groups = { TestGroup.REST_API, TestGroup.DEPLOYMENTS, TestGroup.REGRESSION, TestGroup.WORKFLOW }) - public void deleteDeploymentUsingNonAdminUser() throws Exception - { - deployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel(); - restClient.authenticateUser(userModel).withWorkflowAPI().usingDeployment(deployment).deleteDeployment(); - restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN) - .assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED); - } -} diff --git a/e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentSanityTests.java b/e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentTests.java similarity index 77% rename from e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentSanityTests.java rename to e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentTests.java index 2301d5e45..0a929fd0e 100644 --- a/e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/workflow/deployments/DeleteDeploymentTests.java @@ -26,15 +26,16 @@ import org.testng.annotations.Test; * @author Cristina Axinte * */ -public class DeleteDeploymentSanityTests extends RestTest +public class DeleteDeploymentTests extends RestTest { - private UserModel adminUser; + private UserModel adminUser, userModel; private RestDeploymentModel deployment; @BeforeClass(alwaysRun = true) public void dataPreparation() throws Exception { adminUser = dataUser.getAdminUser(); + userModel = dataUser.createRandomTestUser(); } @Bug(id = "REPO-1930") @@ -115,4 +116,29 @@ public class DeleteDeploymentSanityTests extends RestTest restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "1000")); } + + @Bug(id = "REPO-1930") + @TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.REGRESSION, + description = "Verify deleteDeployment is unsupported for empty deployment id with REST API and status code is 404") + @Test(groups = { TestGroup.REST_API, TestGroup.DEPLOYMENTS, TestGroup.REGRESSION, TestGroup.WORKFLOW }) + public void deleteDeploymentIsUnsupportedForEmptyId() throws Exception + { + deployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel(); + deployment.setId(""); + restClient.withWorkflowAPI().usingDeployment(deployment).deleteDeployment(); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) + .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "")); + } + + @Bug(id = "REPO-1930") + @TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.REGRESSION, + description = "Verify deleteDeployment is forbidden using non admin user or different user than creator with REST API and status code is 403") + @Test(groups = { TestGroup.REST_API, TestGroup.DEPLOYMENTS, TestGroup.REGRESSION, TestGroup.WORKFLOW }) + public void deleteDeploymentUsingNonAdminUser() throws Exception + { + deployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel(); + restClient.authenticateUser(userModel).withWorkflowAPI().usingDeployment(deployment).deleteDeployment(); + restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN) + .assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED); + } }