From 2942cf98d3d7a729123687279fc40c6e20dca0c1 Mon Sep 17 00:00:00 2001 From: Cristina Axinte Date: Thu, 26 Jan 2017 19:04:13 +0200 Subject: [PATCH] fixed 3 tests and added one test to cover the new logged bug REPO-1889 --- .../sites/UpdateSiteMemberSanityTests.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java index 6e021d1f0..f60de1cdd 100644 --- a/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java @@ -50,6 +50,9 @@ public class UpdateSiteMemberSanityTests extends RestTest description = "Verify that collaborator is not able to update site member and gets status code FORBIDDEN (403)") public void collaboratorIsNotAbleToUpdateSiteMember() throws Exception { + UserModel testUserModel = dataUser.createRandomTestUser(); + dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer); + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)); testUserModel.setUserRole(UserRole.SiteCollaborator); restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel); @@ -58,11 +61,31 @@ public class UpdateSiteMemberSanityTests extends RestTest .containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", siteModel.getTitle())); } + @Bug(id = "REPO-1889") + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, + description = "Verify that collaborator is not able to update site member and gets status code FORBIDDEN (403)") + public void collaboratorIsNotAbleToUpdateSiteMemberWithTheSameRole() throws Exception + { + UserModel testUserModel = dataUser.createRandomTestUser(); + dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer); + + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)); + testUserModel.setUserRole(UserRole.SiteConsumer); + restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY); + restClient.assertLastError() + .containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", siteModel.getTitle())); + } + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that contributor is not able to update site member and gets status code FORBIDDEN (403)") public void contributorIsNotAbleToUpdateSiteMember() throws Exception { + UserModel testUserModel = dataUser.createRandomTestUser(); + dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer); + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)); testUserModel.setUserRole(UserRole.SiteCollaborator); restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel); @@ -76,6 +99,9 @@ public class UpdateSiteMemberSanityTests extends RestTest description = "Verify that consumer is not able to update site member and gets status code FORBIDDEN (403)") public void consumerIsNotAbleToUpdateSiteMember() throws Exception { + UserModel testUserModel = dataUser.createRandomTestUser(); + dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer); + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)); testUserModel.setUserRole(UserRole.SiteCollaborator); restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);