diff --git a/e2e-test/java/org/alfresco/rest/comments/AddCommentCoreTests.java b/e2e-test/java/org/alfresco/rest/comments/AddCommentCoreTests.java index 00d624fab..cfb3f96c8 100644 --- a/e2e-test/java/org/alfresco/rest/comments/AddCommentCoreTests.java +++ b/e2e-test/java/org/alfresco/rest/comments/AddCommentCoreTests.java @@ -9,13 +9,7 @@ import org.alfresco.rest.model.RestTagModel; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.RandomData; -import org.alfresco.utility.model.ErrorModel; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FileType; -import org.alfresco.utility.model.LinkModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -141,7 +135,7 @@ public class AddCommentCoreTests extends RestTest restClient.authenticateUser(member) .withCoreAPI().usingResource(document).addComment(comment); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } @TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION, diff --git a/e2e-test/java/org/alfresco/rest/comments/AddCommentSanityTests.java b/e2e-test/java/org/alfresco/rest/comments/AddCommentSanityTests.java index a10980ce4..f08b0318b 100644 --- a/e2e-test/java/org/alfresco/rest/comments/AddCommentSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/comments/AddCommentSanityTests.java @@ -5,11 +5,7 @@ import org.alfresco.rest.RestTest; import org.alfresco.rest.exception.JsonToModelConversionException; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; -import org.alfresco.utility.model.ErrorModel; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -97,7 +93,7 @@ public class AddCommentSanityTests extends RestTest { restClient.authenticateUser(new UserModel("random user", "random password")); restClient.withCoreAPI().usingResource(document).addComment("This is a new comment"); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/comments/UpdateCommentsSanityTests.java b/e2e-test/java/org/alfresco/rest/comments/UpdateCommentsSanityTests.java index fe30b9575..5da722321 100644 --- a/e2e-test/java/org/alfresco/rest/comments/UpdateCommentsSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/comments/UpdateCommentsSanityTests.java @@ -6,12 +6,7 @@ import org.alfresco.rest.exception.JsonToModelConversionException; import org.alfresco.rest.model.RestCommentModel; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; -import org.alfresco.utility.model.ErrorModel; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -109,7 +104,7 @@ public class UpdateCommentsSanityTests extends RestTest UserModel incorrectUserModel = new UserModel("userName", "password"); restClient.authenticateUser(incorrectUserModel) .withCoreAPI().usingResource(document).updateComment(commentModel, "try to update"); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } @TestRail(section = { TestGroup.REST_API, TestGroup.SANITY }, executionType = ExecutionType.SANITY, description = "Verify update comment with inexistent nodeId returns status code 404") diff --git a/e2e-test/java/org/alfresco/rest/favorites/AddFavoritesSanityTests.java b/e2e-test/java/org/alfresco/rest/favorites/AddFavoritesSanityTests.java index b6a547ccf..efd5baff2 100644 --- a/e2e-test/java/org/alfresco/rest/favorites/AddFavoritesSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/favorites/AddFavoritesSanityTests.java @@ -7,6 +7,7 @@ import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -102,6 +103,6 @@ public class AddFavoritesSanityTests extends RestTest UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager); siteManager.setPassword("wrongPassword"); restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/favorites/GetFavoriteSanityTests.java b/e2e-test/java/org/alfresco/rest/favorites/GetFavoriteSanityTests.java index 3bd440fd2..c6a5e6e1c 100644 --- a/e2e-test/java/org/alfresco/rest/favorites/GetFavoriteSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/favorites/GetFavoriteSanityTests.java @@ -7,12 +7,7 @@ import org.alfresco.rest.model.RestPersonFavoritesModelsCollection; import org.alfresco.rest.model.RestSiteModelsCollection; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; -import org.alfresco.utility.model.ErrorModel; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -172,7 +167,7 @@ public class GetFavoriteSanityTests extends RestTest siteManager.setPassword("wrongPassword"); restClient.authenticateUser(siteManager).withCoreAPI() .usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).getFavorite(siteModel.getGuid()); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/favorites/GetFavoritesSanityTests.java b/e2e-test/java/org/alfresco/rest/favorites/GetFavoritesSanityTests.java index 0eeab7df4..e5937ce1c 100644 --- a/e2e-test/java/org/alfresco/rest/favorites/GetFavoritesSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/favorites/GetFavoritesSanityTests.java @@ -6,12 +6,7 @@ import org.alfresco.rest.exception.JsonToModelConversionException; import org.alfresco.rest.model.RestPersonFavoritesModelsCollection; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; -import org.alfresco.utility.model.ErrorModel; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -184,6 +179,6 @@ public class GetFavoritesSanityTests extends RestTest UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager); siteManager.setPassword("wrongPassword"); restClient.authenticateUser(siteManager).withCoreAPI().usingAuthUser().getFavorites(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/AddFavoriteSiteSanityTests.java b/e2e-test/java/org/alfresco/rest/people/AddFavoriteSiteSanityTests.java index f0fe52649..3cf2d770c 100644 --- a/e2e-test/java/org/alfresco/rest/people/AddFavoriteSiteSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/AddFavoriteSiteSanityTests.java @@ -4,6 +4,7 @@ import org.alfresco.rest.RestTest; import org.alfresco.rest.model.RestFavoriteSiteModel; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -95,6 +96,6 @@ public class AddFavoriteSiteSanityTests extends RestTest managerUser.setPassword("newpassword"); restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().addFavoriteSite(siteModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/AddSiteMembershipRequestSanityTests.java b/e2e-test/java/org/alfresco/rest/people/AddSiteMembershipRequestSanityTests.java index 637aac2b5..d392f9ab9 100644 --- a/e2e-test/java/org/alfresco/rest/people/AddSiteMembershipRequestSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/AddSiteMembershipRequestSanityTests.java @@ -9,6 +9,7 @@ import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -121,11 +122,9 @@ public class AddSiteMembershipRequestSanityTests extends RestTest @Bug(id = "MNT-16557") public void unauthenticatedUserIsNotAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception { - requestModel = restClient.authenticateUser(new UserModel("random user", "random password")) + restClient.authenticateUser(new UserModel("random user", "random password")) .withCoreAPI() .usingUser(newMember).addSiteMembershipRequest(siteModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); - requestModel.assertThat().field("id").isNotEmpty() - .assertThat().field("site").isNotEmpty(); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteSanityTests.java b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteSanityTests.java index bdacbb87a..0f5505ad2 100644 --- a/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/DeleteFavoriteSiteSanityTests.java @@ -2,10 +2,8 @@ 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.model.*; +import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; import org.springframework.http.HttpStatus; @@ -115,6 +113,7 @@ public class DeleteFavoriteSiteSanityTests extends RestTest restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED); } + @Bug(id = "MNT-16904") @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)") @@ -127,6 +126,6 @@ public class DeleteFavoriteSiteSanityTests extends RestTest managerUser.setPassword("newpassword"); restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/DeleteSiteMembershipRequestSanityTests.java b/e2e-test/java/org/alfresco/rest/people/DeleteSiteMembershipRequestSanityTests.java index ee0142301..bf7c89503 100644 --- a/e2e-test/java/org/alfresco/rest/people/DeleteSiteMembershipRequestSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/DeleteSiteMembershipRequestSanityTests.java @@ -6,10 +6,7 @@ import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.data.RandomData; import org.alfresco.utility.exception.DataPreparationException; -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.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -157,7 +154,8 @@ public class DeleteSiteMembershipRequestSanityTests extends RestTest restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN) .assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED); } - + + @Bug(id = "MNT-16904") @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Failed authentication get site member call returns status code 401") @@ -170,6 +168,6 @@ public class DeleteSiteMembershipRequestSanityTests extends RestTest restClient.authenticateUser(inexistentUser) .withCoreAPI() .usingAuthUser().deleteSiteMembershipRequest(siteModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/GetFavoriteSiteSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetFavoriteSiteSanityTests.java index 36e899141..61f379312 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetFavoriteSiteSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetFavoriteSiteSanityTests.java @@ -3,10 +3,7 @@ package org.alfresco.rest.people; import org.alfresco.rest.RestTest; import org.alfresco.rest.model.RestSiteModel; 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.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -139,6 +136,6 @@ public class GetFavoriteSiteSanityTests extends RestTest managerUser.setPassword("newpassword"); restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getFavoriteSite(siteModel1); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/GetFavoriteSitesSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetFavoriteSitesSanityTests.java index b5d2412ac..eebc052c3 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetFavoriteSitesSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetFavoriteSitesSanityTests.java @@ -3,10 +3,7 @@ package org.alfresco.rest.people; import org.alfresco.rest.RestTest; import org.alfresco.rest.model.RestSiteModelsCollection; 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.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -128,6 +125,6 @@ public class GetFavoriteSitesSanityTests extends RestTest anyUser.setPassword("newpassword"); restClient.authenticateUser(anyUser).withCoreAPI().usingAuthUser().getFavoriteSites(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesSanityTests.java index 1b10b5ec8..a9e7dd633 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesSanityTests.java @@ -5,6 +5,7 @@ import org.alfresco.rest.RestTest; import org.alfresco.rest.model.RestActivityModelsCollection; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -117,6 +118,6 @@ public class GetPeopleActivitiesSanityTests extends RestTest managerUser.setPassword("newpassword"); restClient.authenticateUser(managerUser).withCoreAPI().usingUser(userModel).getPersonActivities(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferenceSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferenceSanityTests.java index 504f42e02..674d7c6b4 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferenceSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferenceSanityTests.java @@ -5,6 +5,7 @@ import org.alfresco.rest.model.RestPreferenceModel; import org.alfresco.utility.constants.PreferenceName; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -114,6 +115,6 @@ public class GetPeoplePreferenceSanityTests extends RestTest restClient.authenticateUser(managerUser) .withCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferencesSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferencesSanityTests.java index 394381427..413a2a959 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferencesSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetPeoplePreferencesSanityTests.java @@ -5,6 +5,7 @@ import org.alfresco.rest.model.RestPreferenceModelsCollection; import org.alfresco.utility.constants.PreferenceName; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -114,7 +115,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to gets its preferences with Rest API when authentication fails(401)") - public void managerUserGetsPeoplePreferencesIsNotAUthorized() throws Exception + public void managerUserGetsPeoplePreferencesIsNotAuthorized() throws Exception { UserModel managerUser = dataUser.usingAdmin().createRandomTestUser(); dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager); @@ -122,6 +123,6 @@ public class GetPeoplePreferencesSanityTests extends RestTest managerUser.setPassword("newpassword"); restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getPersonPreferences(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipRequestSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipRequestSanityTests.java index de1a9f953..fd5946a50 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipRequestSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipRequestSanityTests.java @@ -8,6 +8,7 @@ import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -128,6 +129,6 @@ public class GetSiteMembershipRequestSanityTests extends RestTest .addSiteMembershipRequest(siteModel); restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipSanityTests.java index 48624edfb..86741e5e4 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetSiteMembershipSanityTests.java @@ -6,6 +6,7 @@ import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -115,6 +116,6 @@ public class GetSiteMembershipSanityTests extends RestTest .withCoreAPI() .usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)) .getSiteMembership(siteModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/people/GetSitesMembershipInformationSanityTests.java b/e2e-test/java/org/alfresco/rest/people/GetSitesMembershipInformationSanityTests.java index a401110eb..eeb6afc63 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetSitesMembershipInformationSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetSitesMembershipInformationSanityTests.java @@ -6,6 +6,7 @@ import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -116,6 +117,6 @@ public class GetSitesMembershipInformationSanityTests extends RestTest .withCoreAPI() .usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)) .getSitesMembershipInformation(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/ratings/AddRatingSanityTests.java b/e2e-test/java/org/alfresco/rest/ratings/AddRatingSanityTests.java index 777dd778c..5f49db8c7 100644 --- a/e2e-test/java/org/alfresco/rest/ratings/AddRatingSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/ratings/AddRatingSanityTests.java @@ -6,11 +6,7 @@ import org.alfresco.rest.model.RestRatingModel; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -117,7 +113,7 @@ public class AddRatingSanityTests extends RestTest public void unauthenticatedUserIsNotAbleToLikeDocument() throws Exception { restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingResource(document).likeDocument(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } @TestRail(section = { TestGroup.REST_API, @@ -173,7 +169,7 @@ public class AddRatingSanityTests extends RestTest restClient.assertStatusCodeIs(HttpStatus.CREATED); returnedRatingModel.assertThat().field("myRating").is(String.valueOf(3)) .and().field("id").is("fiveStar") - .and().field("aggregate").isNotEmpty();; + .and().field("aggregate").isNotEmpty(); } @TestRail(section = { TestGroup.REST_API, @@ -182,6 +178,6 @@ public class AddRatingSanityTests extends RestTest public void unauthenticatedUserIsNotAbleToRateStarsToDocument() throws Exception { restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingResource(document).rateStarsToDocument(5); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/ratings/DeleteRatingSanityTests.java b/e2e-test/java/org/alfresco/rest/ratings/DeleteRatingSanityTests.java index 5b21b39fb..e028d229e 100644 --- a/e2e-test/java/org/alfresco/rest/ratings/DeleteRatingSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/ratings/DeleteRatingSanityTests.java @@ -6,11 +6,7 @@ import org.alfresco.rest.model.RestRatingModelsCollection; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.model.*; import org.alfresco.utility.report.Bug; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -160,8 +156,9 @@ public class DeleteRatingSanityTests extends RestTest .assertNodeHasNoFiveStarRating() .and().entriesListIsNotEmpty() .and().paginationExist(); - } - + } + + @Bug(id = "MNT-16904") @TestRail(section = {TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to remove its own rating of a document") public void unauthenticatedUserIsNotAbleToDeleteRatings() throws Exception @@ -175,10 +172,10 @@ public class DeleteRatingSanityTests extends RestTest restClient.authenticateUser(new UserModel("random user", "random password")); restClient.withCoreAPI().usingResource(document).deleteLikeRating(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); restClient.withCoreAPI().usingResource(document).deleteFiveStarRating(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } @TestRail(section = {TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.SANITY, @@ -197,9 +194,9 @@ public class DeleteRatingSanityTests extends RestTest restClient.authenticateUser(userB); restClient.authenticateUser(userB).withCoreAPI().usingResource(document).deleteLikeRating(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); restClient.withCoreAPI().usingResource(document).deleteFiveStarRating(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/sites/AddSiteMemberSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/AddSiteMemberSanityTests.java index 62c24caff..7b82ebb5e 100644 --- a/e2e-test/java/org/alfresco/rest/sites/AddSiteMemberSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/AddSiteMemberSanityTests.java @@ -4,6 +4,7 @@ import org.alfresco.rest.RestTest; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -105,6 +106,6 @@ public class AddSiteMemberSanityTests extends RestTest UserModel inexistentUser = new UserModel("inexistent user", "inexistent password"); restClient.authenticateUser(inexistentUser) .withCoreAPI().usingSite(siteModel).addPerson(testUser); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/sites/GetSiteContainerSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/GetSiteContainerSanityTests.java index 45478751d..3e8be929b 100644 --- a/e2e-test/java/org/alfresco/rest/sites/GetSiteContainerSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/GetSiteContainerSanityTests.java @@ -5,6 +5,7 @@ import org.alfresco.rest.model.RestSiteContainerModel; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -108,6 +109,6 @@ public class GetSiteContainerSanityTests extends RestTest dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager); restClient.authenticateUser(userModel) .withCoreAPI().usingSite(siteModel).getSiteContainer(siteContainerModel.onModel()); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/sites/GetSiteContainersSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/GetSiteContainersSanityTests.java index a4b7cddb1..509dfea81 100644 --- a/e2e-test/java/org/alfresco/rest/sites/GetSiteContainersSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/GetSiteContainersSanityTests.java @@ -7,6 +7,7 @@ import org.alfresco.utility.data.DataSite; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -112,6 +113,6 @@ public class GetSiteContainersSanityTests extends RestTest dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager); restClient.authenticateUser(userModel) .withCoreAPI().usingSite(siteModel).getSiteContainers(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/sites/GetSiteMemberSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/GetSiteMemberSanityTests.java index 719950e32..620f73374 100644 --- a/e2e-test/java/org/alfresco/rest/sites/GetSiteMemberSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/GetSiteMemberSanityTests.java @@ -6,6 +6,7 @@ import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -100,6 +101,6 @@ public class GetSiteMemberSanityTests extends RestTest UserModel inexistentUser = new UserModel("inexistent user", "inexistent password"); restClient.authenticateUser(inexistentUser); restClient.withCoreAPI().usingSite(siteModel).getSiteMember(userModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/sites/GetSiteSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/GetSiteSanityTests.java index e3afe1129..d2f4b28d2 100644 --- a/e2e-test/java/org/alfresco/rest/sites/GetSiteSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/GetSiteSanityTests.java @@ -8,6 +8,7 @@ import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -117,6 +118,6 @@ public class GetSiteSanityTests extends RestTest restClient.authenticateUser(userModel).withParams("maxItems=10000") .withCoreAPI() .getSites(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/sites/GetSitesSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/GetSitesSanityTests.java index 3e0353f01..c9e25463d 100644 --- a/e2e-test/java/org/alfresco/rest/sites/GetSitesSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/GetSitesSanityTests.java @@ -3,16 +3,14 @@ package org.alfresco.rest.sites; import org.alfresco.rest.RestTest; import org.alfresco.rest.exception.JsonToModelConversionException; import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.data.DataSite; -import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; 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; @@ -108,6 +106,6 @@ public class GetSitesSanityTests extends RestTest dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager); restClient.authenticateUser(userModel).withParams("maxItems=1000") .withCoreAPI().getSites(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/sites/RemoveSiteMemberSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/RemoveSiteMemberSanityTests.java index f0f5df579..17a4daeee 100644 --- a/e2e-test/java/org/alfresco/rest/sites/RemoveSiteMemberSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/RemoveSiteMemberSanityTests.java @@ -6,6 +6,7 @@ import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -101,7 +102,8 @@ public class RemoveSiteMemberSanityTests extends RestTest restClient.withCoreAPI().getSites().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername()); restClient.assertStatusCodeIs(HttpStatus.OK); } - + + @Bug(id="MNT-16904") @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that unauthenticated user is not able to delete site member") public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMember() throws Exception{ @@ -109,6 +111,6 @@ public class RemoveSiteMemberSanityTests extends RestTest restClient.authenticateUser(inexistentUser) .withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } } diff --git a/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java b/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java index a64af8a52..29e4703c0 100644 --- a/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java +++ b/e2e-test/java/org/alfresco/rest/sites/UpdateSiteMemberSanityTests.java @@ -4,6 +4,7 @@ import org.alfresco.rest.RestTest; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.StatusModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -103,6 +104,6 @@ public class UpdateSiteMemberSanityTests extends RestTest restClient.authenticateUser(inexistentUser); testUserModel.setUserRole(UserRole.SiteCollaborator); restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED); } }