diff --git a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java index 74c7bd877..d5c681e18 100644 --- a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java +++ b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java @@ -30,8 +30,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest adminUserModel = dataUser.getAdminUser(); } - @TestRail(section = { TestGroup.REST_API, - TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)") + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)") public void removeFavoriteSiteWithSuccessUsingMeAsPersonId() throws Exception { restClient.authenticateUser(adminUserModel); @@ -46,30 +46,23 @@ public class DeleteFavoriteSiteCoreTests extends RestTest TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify inexistent user is not able to remove a site from favorites and response is 404") public void inexistentUserIsNotAbleToRemoveFavoriteSite() throws Exception { - restClient.authenticateUser(adminUserModel); - dataSite.usingUser(adminUserModel).usingSite(siteModel).addSiteToFavorites(); - UserModel inexistentUser = new UserModel("inexistenUser", "password"); - restClient.withCoreAPI().usingUser(inexistentUser).removeFavoriteSite(siteModel); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() - .containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, "inexistenUser")); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(inexistentUser).removeFavoriteSite(siteModel); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, "inexistenUser")); } - @TestRail(section = { TestGroup.REST_API, - TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404") + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404") public void userIsNotAbleToRemoveFavoriteSiteWithInexistentId() throws Exception { - restClient.authenticateUser(adminUserModel); - dataSite.usingUser(adminUserModel).usingSite(siteModel).addSiteToFavorites(); - SiteModel inexistentSite = new SiteModel("inexistentSite"); - restClient.withCoreAPI().usingUser(adminUserModel).removeFavoriteSite(inexistentSite); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).removeFavoriteSite(inexistentSite); restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() .containsSummary(String.format(ErrorModel.RELATIONSHIP_NOT_FOUND, adminUserModel.getUsername(), inexistentSite.getTitle())); } - @TestRail(section = { TestGroup.REST_API, - TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user removes a site from its favorites abd add it again and response is successful (204)") + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify manager user removes a site from its favorites and adds it again and response is successful (204)") public void managerUserRemovesFavoriteSiteAndAddItAgain() throws Exception { UserModel managerUser = dataUser.usingAdmin().createRandomTestUser(); @@ -82,8 +75,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest restClient.assertStatusCodeIs(HttpStatus.CREATED); } - @TestRail(section = { TestGroup.REST_API, - TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)") + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)") public void managerUserRemovesFavoriteSiteWithSuccess() throws Exception { UserModel managerUser = dataUser.usingAdmin().createRandomTestUser(); @@ -95,7 +88,7 @@ public class DeleteFavoriteSiteCoreTests extends RestTest restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("id", siteModel.getId()); } - @TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION, + @TestRail(section={TestGroup.REST_API, TestGroup.PEOPLE}, executionType= ExecutionType.REGRESSION, description= "Verify uninvited user can delete favorite public site and response is 204") public void uninvitedUserCanDeleteFavoritePublicSite() throws Exception { @@ -107,7 +100,7 @@ public class DeleteFavoriteSiteCoreTests extends RestTest restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", publicSiteModel.getId()); } - @TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION, + @TestRail(section={TestGroup.REST_API, TestGroup.PEOPLE}, executionType= ExecutionType.REGRESSION, description= "Verify uninvited user can delete favorite moderated site and response is 204") public void uninvitedUserCanDeleteFavoriteModeratedSite() throws Exception { @@ -119,7 +112,7 @@ public class DeleteFavoriteSiteCoreTests extends RestTest restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", moderatedSiteModel.getId()); } - @TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.COMMENTS}, executionType= ExecutionType.REGRESSION, + @TestRail(section={TestGroup.REST_API, TestGroup.PEOPLE}, executionType= ExecutionType.REGRESSION, description= "Verify user can delete favorite private site and response is 204") public void userCanDeleteFavoritePrivateSite() throws Exception { @@ -131,4 +124,4 @@ public class DeleteFavoriteSiteCoreTests extends RestTest restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", privateSiteModel.getId()); } -} +} \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/people/DeleteSiteMemberCoreTests.java b/e2e-test/java/org/alfresco/rest/people/DeleteSiteMemberCoreTests.java new file mode 100644 index 000000000..2c9807cfc --- /dev/null +++ b/e2e-test/java/org/alfresco/rest/people/DeleteSiteMemberCoreTests.java @@ -0,0 +1,253 @@ +package org.alfresco.rest.people; + +import org.alfresco.rest.RestTest; +import org.alfresco.utility.constants.UserRole; +import org.alfresco.utility.model.ErrorModel; +import org.alfresco.utility.model.SiteModel; +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.http.HttpStatus; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE }) +public class DeleteSiteMemberCoreTests extends RestTest +{ + private UserModel userModel; + private UserModel managerModel; + private SiteModel publicSiteModel; + private SiteModel moderatedSiteModel; + private SiteModel privateSiteModel; + private UserModel adminUserModel; + private UserModel secondUserModel; + + @BeforeClass(alwaysRun = true) + public void dataPreparation() throws Exception + { + secondUserModel = dataUser.createRandomTestUser(); + secondUserModel.setUserRole(UserRole.SiteCollaborator); + userModel = dataUser.createRandomTestUser(); + userModel.setUserRole(UserRole.SiteCollaborator); + managerModel = dataUser.createRandomTestUser(); + managerModel.setUserRole(UserRole.SiteManager); + adminUserModel = dataUser.getAdminUser(); + publicSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite(); + moderatedSiteModel = dataSite.usingUser(adminUserModel).createModeratedRandomSite(); + privateSiteModel = dataSite.usingUser(adminUserModel).createPrivateRandomSite(); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user removes a site member using '-me-' in place of personId and response is successful (204)") + public void removeSiteMemberWithSuccessUsingMeAsPersonId() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); + + restClient.authenticateUser(userModel).withCoreAPI().usingMe().deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user can't remove a site membership if doesn't have access to personId and response is 422") + public void notAbleToRemoveSiteMemberWithNoAccessToPersonId() throws Exception + { + UserModel user = dataUser.createRandomTestUser(); + dataSite.usingUser(user).createPublicRandomSite(); + + userModel.setUserRole(UserRole.SiteCollaborator); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); + + restClient.authenticateUser(user).withCoreAPI().usingUser(userModel).deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user can't remove a site membership of an inexistent uer and response is 404") + public void userIsNotAbleToRemoveInexistentSiteMember() throws Exception + { + UserModel inexistentUser = new UserModel("inexistenUser", "password"); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(inexistentUser).deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, inexistentUser.getUsername())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove a member of an inexistent site and response is 404") + public void userIsNotAbleToRemoveMembershipOfInexistentSite() throws Exception + { + SiteModel inexistentSite = new SiteModel("inexistentSite"); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(inexistentSite); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(ErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), inexistentSite.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove a member of an empty site id and response is 404") + public void userIsNotAbleToRemoveMembershipOfEmptySiteId() throws Exception + { + SiteModel inexistentSite = new SiteModel(""); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(inexistentSite); + restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError().containsSummary(ErrorModel.DELETE_EMPTY_ARGUMENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove a regular member of a public site and response is 422") + public void regularUserIsNotAbleToRemoveRegularUserSiteMembershipFromPublicSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(secondUserModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); + restClient.authenticateUser(secondUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove a regular member a moderated site and response is 422") + public void regularUserIsNotAbleToRemoveRegularUserSiteMembershipFromModeratedSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(secondUserModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(userModel); + restClient.authenticateUser(secondUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(moderatedSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove a regular member of a private site and response is 422") + public void regularUserIsNotAbleToRemoveRegularUserSiteMembershipFromPrivateSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(secondUserModel); + restClient.authenticateUser(secondUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(privateSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify admin is able to remove a regular member of a public site and response is 204") + public void adminIsAbleToRemoveRegularUserSiteMembershipFromPublicSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify admin is able to remove a regular member of a moderated site and response is 204") + public void adminIsAbleToRemoveRegularUserSiteMembershipFromModeratedSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(userModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(moderatedSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify admin is able to remove a regular member of a private site and response is 204") + public void adminIsAbleToRemoveRegularUserSiteMembershipFromPrivateSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(privateSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove admin membership from public site and response is 422") + public void regularUserIsNotAbleToRemoveAdminSiteMembershipFromPublicSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(managerModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel); + restClient.authenticateUser(userModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove admin membership from moderated site and response is 422") + public void regularUserIsNotAbleToRemoveAdminSiteMembershipFromModeratedSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(managerModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel); + restClient.authenticateUser(userModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(moderatedSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to remove admin membership from private site and response is 422") + public void regularUserIsNotAbleToRemoveAdminSiteMembershipFromPrivateSite() throws Exception + { + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(managerModel); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel); + restClient.authenticateUser(userModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(privateSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify admin is able to remove the membership of a manager from a public site and response is 204") + public void adminIsAbleToRemoveManagerSiteMembershipOfPublicSite() throws Exception + { + UserModel secondManager = dataUser.createRandomTestUser(); + secondManager.setUserRole(UserRole.SiteManager); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(secondManager); + restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(managerModel); + restClient.withCoreAPI().usingUser(managerModel).deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify admin is able to remove the membership of a manager from a moderated site and response is 204") + public void adminIsAbleToRemoveManagerSiteMembershipOfModeratedSite() throws Exception + { + UserModel secondManager = dataUser.createRandomTestUser(); + secondManager.setUserRole(UserRole.SiteManager); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(secondManager); + restClient.withCoreAPI().usingSite(moderatedSiteModel).addPerson(managerModel); + restClient.withCoreAPI().usingUser(managerModel).deleteSiteMember(moderatedSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify admin is able to remove the membership of a manager from a private site and response is 204") + public void adminIsAbleToRemoveManagerSiteMembershipOfPrivateSite() throws Exception + { + UserModel secondManager = dataUser.createRandomTestUser(); + secondManager.setUserRole(UserRole.SiteManager); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(secondManager); + restClient.withCoreAPI().usingSite(privateSiteModel).addPerson(managerModel); + restClient.withCoreAPI().usingUser(managerModel).deleteSiteMember(privateSiteModel); + restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify collaborator is not able to remove the membership of a manager from a public site and response is 204") + public void userIsNotAbleToRemoveManagerSiteMembershipOfPublicSite() throws Exception + { + UserModel secondManager = dataUser.createRandomTestUser(); + secondManager.setUserRole(UserRole.SiteManager); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(secondManager); + restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); + restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(managerModel); + restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerModel).deleteSiteMember(publicSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify collaborator is not able to remove the membership of a manager from a moderated site and response is 204") + public void userIsNotAbleToRemoveManagerSiteMembershipOfModeratedSite() throws Exception + { + UserModel secondManager = dataUser.createRandomTestUser(); + secondManager.setUserRole(UserRole.SiteManager); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(secondManager); + restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); + restClient.withCoreAPI().usingSite(moderatedSiteModel).addPerson(managerModel); + restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerModel).deleteSiteMember(moderatedSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId())); + } + + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify collaborator is not able to remove the membership of a manager from a private site and response is 204") + public void userIsNotAbleToRemoveManagerSiteMembershipOfPrivateSite() throws Exception + { + UserModel secondManager = dataUser.createRandomTestUser(); + secondManager.setUserRole(UserRole.SiteManager); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(secondManager); + restClient.withCoreAPI().usingSite(privateSiteModel).addPerson(userModel); + restClient.withCoreAPI().usingSite(privateSiteModel).addPerson(managerModel); + restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerModel).deleteSiteMember(privateSiteModel); + restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(ErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId())); + } +} \ No newline at end of file