From 1cb8bc7de954651bab28705e19891aeded1ddbc3 Mon Sep 17 00:00:00 2001 From: Cristina Jalba Date: Thu, 24 Nov 2016 14:31:28 +0200 Subject: [PATCH 1/2] Core-REST API: removeMemberFromSIte tests --- .../people/DeleteFavoriteSiteCoreTests.java | 15 +- .../people/DeleteSiteMemberCoreTests.java | 254 ++++++++++++++++++ 2 files changed, 258 insertions(+), 11 deletions(-) create mode 100644 e2e-test/java/org/alfresco/rest/people/DeleteSiteMemberCoreTests.java diff --git a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java index 7aa1d952a..2877c6bef 100644 --- a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java +++ b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java @@ -42,26 +42,19 @@ public class DeleteFavoriteSiteCoreTests extends RestTest @TestRail(section = { TestGroup.REST_API, 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 + public void userIsNotAbleToRemoveFavoriteSiteOfInexistentUser() 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") 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())); } 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..627997442 --- /dev/null +++ b/e2e-test/java/org/alfresco/rest/people/DeleteSiteMemberCoreTests.java @@ -0,0 +1,254 @@ +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 secondManager = dataUser.createRandomTestUser(); + dataSite.usingUser(secondManager).createPublicRandomSite(); + + userModel.setUserRole(UserRole.SiteCollaborator); + restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); + + restClient.authenticateUser(secondManager).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 userIsNotAbleToRemoveSiteMemberOfAnInexistentUser() 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 membership 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 membership 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 membership of another regular user from 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 membership of another regular user from 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 membership of another regular user from 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 the membership of another regular user from 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 the membership of another regular user from 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 the membership of another regular user from 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 the membership of admin 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 the membership of admin 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 the membership of admin 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 manager of 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 manager of 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 manager of 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 manager of 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 manager of 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 manager of 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())); + } +} From 0f4252a6d1aa1a0f7a0f0642cc8c8ce1c5a61d1a Mon Sep 17 00:00:00 2001 From: Valentin Popa Date: Tue, 29 Nov 2016 16:24:14 +0200 Subject: [PATCH 2/2] Minor changes for delete favorite site and delete site member --- .../people/DeleteFavoriteSiteCoreTests.java | 28 +++--- .../people/DeleteSiteMemberCoreTests.java | 91 +++++++++---------- 2 files changed, 59 insertions(+), 60 deletions(-) diff --git a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java index 2877c6bef..f5a9f015d 100644 --- a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java +++ b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteCoreTests.java @@ -29,8 +29,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); @@ -40,8 +40,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); } - @TestRail(section = { TestGroup.REST_API, - TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify inexistent user is not able to remove a site from favorites and response is 404") + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, + description = "Verify inexistent user is not able to remove a site from favorites and response is 404") public void userIsNotAbleToRemoveFavoriteSiteOfInexistentUser() throws Exception { UserModel inexistentUser = new UserModel("inexistenUser", "password"); @@ -49,8 +49,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest 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 { SiteModel inexistentSite = new SiteModel("inexistentSite"); @@ -59,8 +59,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest .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(); @@ -73,8 +73,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(); @@ -86,7 +86,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 { @@ -98,7 +98,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 { @@ -110,7 +110,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 { @@ -122,4 +122,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 index 627997442..2c9807cfc 100644 --- a/e2e-test/java/org/alfresco/rest/people/DeleteSiteMemberCoreTests.java +++ b/e2e-test/java/org/alfresco/rest/people/DeleteSiteMemberCoreTests.java @@ -15,7 +15,6 @@ 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; @@ -39,8 +38,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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)") + @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); @@ -49,31 +48,31 @@ public class DeleteSiteMemberCoreTests extends RestTest 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") + @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 secondManager = dataUser.createRandomTestUser(); - dataSite.usingUser(secondManager).createPublicRandomSite(); + UserModel user = dataUser.createRandomTestUser(); + dataSite.usingUser(user).createPublicRandomSite(); userModel.setUserRole(UserRole.SiteCollaborator); restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel); - restClient.authenticateUser(secondManager).withCoreAPI().usingUser(userModel).deleteSiteMember(publicSiteModel); + 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 userIsNotAbleToRemoveSiteMemberOfAnInexistentUser() throws Exception + @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 membership of an inexistent site and response is 404") + @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"); @@ -81,8 +80,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 membership of an empty site id and response is 404") + @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(""); @@ -90,8 +89,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 membership of another regular user from public site and response is 422") + @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); @@ -100,8 +99,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 membership of another regular user from moderated site and response is 422") + @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); @@ -110,8 +109,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 membership of another regular user from private site and response is 422") + @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); @@ -120,8 +119,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 another regular user from public site and response is 204") + @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); @@ -129,8 +128,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 another regular user from moderated site and response is 204") + @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); @@ -138,8 +137,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 another regular user from private site and response is 204") + @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); @@ -147,8 +146,8 @@ public class DeleteSiteMemberCoreTests extends RestTest restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); } - @TestRail(section = { TestGroup.REST_API, - TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove the membership of admin from public site and response is 422") + @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); @@ -157,8 +156,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 the membership of admin from moderated site and response is 422") + @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); @@ -167,8 +166,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 the membership of admin from private site and response is 422") + @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); @@ -177,8 +176,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 manager of a public site and response is 204") + @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(); @@ -189,8 +188,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 manager of a moderated site and response is 204") + @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(); @@ -201,8 +200,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 manager of a private site and response is 204") + @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(); @@ -213,8 +212,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 manager of a public site and response is 204") + @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(); @@ -226,8 +225,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 manager of a moderated site and response is 204") + @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(); @@ -239,8 +238,8 @@ public class DeleteSiteMemberCoreTests extends RestTest 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 manager of a private site and response is 204") + @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(); @@ -251,4 +250,4 @@ public class DeleteSiteMemberCoreTests extends RestTest 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