mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
added assertLastException
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user