core: add lastException in wrapper/formatting

initialize Node, People
test: update test to assert on last error. Remove @Bug annotation tests passed
This commit is contained in:
Paul Brodner
2016-12-13 23:17:54 +02:00
parent 96c4864a94
commit c7ec0786d8
45 changed files with 144 additions and 166 deletions
@@ -10,7 +10,13 @@ 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.*;
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.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;
@@ -142,7 +148,7 @@ public class AddCommentCoreTests extends RestTest
restClient.authenticateUser(member)
.withCoreAPI().usingResource(document).addComment(comment);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION,
@@ -101,13 +101,12 @@ public class AddCommentSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user gets status code 401 on post comments call")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public void unauthenticatedUserIsNotAbleToAddComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.withCoreAPI().usingResource(document).addComment("This is a new comment");
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -6,8 +6,11 @@ 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.*;
import org.alfresco.utility.report.Bug;
import org.alfresco.utility.model.FileModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -76,10 +79,8 @@ public class DeleteCommentsSanityTests extends RestTest
restClient.withCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@Bug(id="MNT-16904")
@TestRail(section = { TestGroup.REST_API,
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify User gets status code 401 if authentication call fails")
@TestRail(section = { TestGroup.REST_API,TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify User gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public void userIsNotAbleToDeleteCommentIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
@@ -88,6 +89,6 @@ public class DeleteCommentsSanityTests extends RestTest
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
restClient.authenticateUser(nonexistentModel);
restClient.withCoreAPI().usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -4,10 +4,13 @@ import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.rest.model.RestCommentModelsCollection;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.*;
import org.alfresco.utility.model.FileModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -100,8 +103,7 @@ public class GetCommentsSanityTests extends RestTest
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
restClient.authenticateUser(nonexistentModel).withCoreAPI()
.usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
@TestRail(section={TestGroup.REST_API, TestGroup.SANITY}, executionType= ExecutionType.SANITY,
@@ -7,7 +7,12 @@ import org.alfresco.rest.model.RestCommentModel;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.*;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
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;
@@ -101,7 +106,6 @@ public class UpdateCommentsSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API,
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user gets status code 401 on update comment call")
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
public void unauthenticatedUserIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
@@ -110,7 +114,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).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.SANITY }, executionType = ExecutionType.SANITY, description = "Verify update comment with inexistent nodeId returns status code 404")
@@ -8,8 +8,6 @@ import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.SiteModel;
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;
@@ -3,8 +3,6 @@ package org.alfresco.rest.demo;
import org.alfresco.rest.RestTest;
import org.alfresco.utility.exception.DataPreparationException;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
@@ -6,8 +6,6 @@ import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.exception.DataPreparationException;
import org.alfresco.utility.model.SiteModel;
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;
@@ -98,6 +98,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).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -8,8 +8,12 @@ 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.*;
import org.alfresco.utility.report.Bug;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -168,7 +172,6 @@ public class GetFavoriteSanityTests extends RestTest
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()));
}
@Bug(id="MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
description = "Verify user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
@@ -178,6 +181,6 @@ public class GetFavoriteSanityTests extends RestTest
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager).withCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).getFavorite(siteModel.getGuid());
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -7,8 +7,12 @@ import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestPersonFavoritesModelsCollection;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.*;
import org.alfresco.utility.report.Bug;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -181,7 +185,6 @@ public class GetFavoritesSanityTests extends RestTest
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()));
}
@Bug(id="MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
description = "Verify user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
@@ -190,6 +193,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).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -7,7 +7,6 @@ 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.http.HttpStatus;
@@ -91,8 +90,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
restFavoriteSiteModel.assertThat().field("id").is(siteModel.getId());
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify a manager user is NOT Authorized to add a favorite site with Rest API when authentication fails (401)")
public void managerUserNotAuthorizedFailsToAddFavoriteSite() throws Exception
{
@@ -101,6 +99,6 @@ public class AddFavoriteSiteSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().addFavoriteSite(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -20,7 +20,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@Test(groups="DEV")
public class AddSiteMembershipRequestSanityTests extends RestTest
{
@Autowired
@@ -107,11 +107,10 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to create new site membership request")
@Bug(id = "MNT-16557")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to create new site membership request")
public void unauthenticatedUserIsNotAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -3,8 +3,10 @@ package org.alfresco.rest.people;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.*;
import org.alfresco.utility.report.Bug;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -108,8 +110,7 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@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)")
public void managerUserNotAuthorizedFailsToRemoveFavoriteSite() throws Exception
{
@@ -120,6 +121,6 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -10,7 +10,6 @@ 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.http.HttpStatus;
@@ -99,14 +98,13 @@ public class DeleteSiteMemberSanityTests extends RestTest
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, siteModel.getId()));
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to delete another member of the site")
public void unauthenticatedUserIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).deleteSiteMember(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -7,7 +7,10 @@ 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.*;
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;
@@ -121,14 +124,13 @@ public class DeleteSiteMembershipRequestSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Failed authentication get site member call returns status code 401")
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMmebershipRequest() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(dataUser.createRandomTestUser()).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser).withCoreAPI().usingAuthUser().deleteSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -4,8 +4,10 @@ import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestSiteModel;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.*;
import org.alfresco.utility.report.Bug;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -118,7 +120,6 @@ public class GetFavoriteSiteSanityTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized gets its specific favorite site with Rest API when authentication fails (401)")
public void managerUserNotAuthorizedFailsToGetFavoriteSite() throws Exception
{
@@ -129,6 +130,6 @@ public class GetFavoriteSiteSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -4,8 +4,10 @@ import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestSiteModelsCollection;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.*;
import org.alfresco.utility.report.Bug;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -106,8 +108,7 @@ public class GetFavoriteSitesSanityTests extends RestTest
restSiteModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("id", siteModel.getId()).and().paginationExist();
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify any user is NOT Authorized to get its favorite sites with Rest API when authentication fails (401)")
public void anyUserNotAuthenticatedIsNotAuthorizedToGetFavoriteSites() throws Exception
{
@@ -116,6 +117,6 @@ public class GetFavoriteSitesSanityTests extends RestTest
anyUser.setPassword("newpassword");
restClient.authenticateUser(anyUser).withCoreAPI().usingAuthUser().getFavoriteSites();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -3,10 +3,10 @@ package org.alfresco.rest.people;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestActivityModelsCollection;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
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.testrail.ExecutionType;
@@ -100,6 +100,6 @@ public class GetPeopleActivitiesSanityTests extends RestTest
public void unauthenticatedUserShouldNotGetPeopleActivitiesList() throws Exception
{
restClient.authenticateUser(unauthenticatedUser).withCoreAPI().usingUser(userModel).getPersonActivities();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -8,7 +8,6 @@ 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.http.HttpStatus;
@@ -104,7 +103,6 @@ public class GetPeoplePreferenceSanityTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to get a specific preference with Rest API when authentication fails (401)")
public void managerUserNotAuthorizedFailsToGetsAPreference() throws Exception
{
@@ -115,6 +113,6 @@ public class GetPeoplePreferenceSanityTests extends RestTest
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser()
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -8,7 +8,6 @@ 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.http.HttpStatus;
@@ -106,7 +105,6 @@ public class GetPeoplePreferencesSanityTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@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
{
@@ -116,6 +114,6 @@ public class GetPeoplePreferencesSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getPersonPreferences();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -108,13 +108,12 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve site membership request")
@Bug(id = "MNT-16557")
public void unauthenticatedUserIsNotAbleToRetrieveSiteMembershipRequest() throws JsonToModelConversionException, Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -9,7 +9,6 @@ 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.http.HttpStatus;
@@ -80,11 +79,10 @@ public class GetSiteMembershipSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve site membership information of another user")
@Bug(id = "MNT-16904")
public void unauthenticatedUserCannotRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI()
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).getSiteMembership(siteModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -9,7 +9,6 @@ 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.http.HttpStatus;
@@ -78,12 +77,11 @@ public class GetSitesMembershipInformationSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify that unauthenticated user is not able to retrieve sites membership information")
@Bug(id = "MNT-16904")
public void unauthenticatedUserCannotRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
UserModel inexistentUser = new UserModel("inexistent user", "wrong password");
restClient.authenticateUser(inexistentUser).withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.getSitesMembershipInformation();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -5,6 +5,7 @@ import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestSiteMembershipRequestModel;
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.testrail.ExecutionType;
@@ -37,7 +38,7 @@ public class UpdateSiteMembershipRequestCoreTests extends RestTest
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
newMember.setPassword("fakePass");
restClient.withCoreAPI().usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@@ -2,12 +2,17 @@ package org.alfresco.rest.ratings;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel;
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.*;
import org.alfresco.utility.report.Bug;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils;
@@ -16,6 +21,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@Test(groups="DEV")
public class AddRatingSanityTests extends RestTest
{
private UserModel userModel;
@@ -105,12 +111,11 @@ public class AddRatingSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to post like rating to a document")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void unauthenticatedUserIsNotAbleToLikeDocument() throws Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(RestErrorModel.AUTHENTICATION_FAILED);
}
@TestRail(section = { TestGroup.REST_API,
@@ -165,16 +170,15 @@ public class AddRatingSanityTests extends RestTest
{
returnedRatingModel = restClient.authenticateUser(adminUser).withCoreAPI().usingResource(document).rateStarsToDocument(3);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is(String.valueOf(3)).and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty();
returnedRatingModel.assertThat().field("myRating").is("3").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty();
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to post stars rating to a document")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void unauthenticatedUserIsNotAbleToRateStarsToDocument() throws Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -6,8 +6,12 @@ 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.*;
import org.alfresco.utility.report.Bug;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FolderModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -148,8 +152,7 @@ public class DeleteRatingSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModelCollection.assertNodeIsNotLiked().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")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
@@ -165,16 +168,14 @@ public class DeleteRatingSanityTests extends RestTest
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.withCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
restClient.withCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify one user is not able to remove rating added by another user")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
@Bug(id = "ACE-5459")
@TestRail(section = { TestGroup.REST_API,TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify one user is not able to remove rating added by another user")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void oneUserIsNotAbleToDeleteRatingsOfAnotherUser() throws Exception
{
UserModel userA = dataUser.createRandomTestUser();
@@ -188,9 +189,9 @@ public class DeleteRatingSanityTests extends RestTest
restClient.authenticateUser(userB);
restClient.authenticateUser(userB).withCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
restClient.withCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -134,6 +134,6 @@ public class GetRatingsSanityTests extends RestTest
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.withCoreAPI().usingResource(document).getRatings();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(RestErrorModel.AUTHENTICATION_FAILED);
}
}
@@ -7,7 +7,6 @@ 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.http.HttpStatus;
@@ -101,7 +100,7 @@ public class AddSiteMemberSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that unauthenticated user is not able to add site member")
@@ -111,6 +110,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).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -8,7 +8,6 @@ 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.http.HttpStatus;
@@ -102,8 +101,7 @@ public class GetSiteContainerSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Failed authentication get site container call returns status code 401")
@Bug(id="MNT-16904")
description = "Failed authentication get site container call returns status code 401")
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteContainer() throws Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
@@ -113,6 +111,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).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -3,17 +3,13 @@ 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;
@@ -101,7 +97,6 @@ public class GetSiteContainersSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Failed authentication get site containers call returns status code 401 with Manager role")
@@ -112,6 +107,6 @@ public class GetSiteContainersSanityTests extends RestTest
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel)
.withCoreAPI().usingSite(siteModel).getSiteContainers();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -9,7 +9,6 @@ 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.http.HttpStatus;
@@ -100,12 +99,11 @@ public class GetSiteMemberSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Failed authentication get site member call returns status code 401")
@Bug(id = "MNT-16904")
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteMember() throws JsonToModelConversionException, Exception
{
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser);
restClient.withCoreAPI().usingSite(siteModel).getSiteMember(userModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -3,18 +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.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;
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;
@@ -97,7 +93,6 @@ public class GetSiteMembersSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Failed authentication get site members call returns status code 401")
@@ -108,6 +103,6 @@ public class GetSiteMembersSanityTests extends RestTest
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel)
.withCoreAPI().usingSite(siteModel).getSiteMembers();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -3,18 +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.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;
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;
@@ -105,7 +101,6 @@ public class GetSiteSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Failed authentication get site call returns status code 401")
@@ -117,6 +112,6 @@ public class GetSiteSanityTests extends RestTest
restClient.authenticateUser(userModel).withParams("maxItems=10000")
.withCoreAPI()
.getSites();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -8,7 +8,6 @@ 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.http.HttpStatus;
@@ -99,7 +98,6 @@ public class GetSitesSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Failed authentication get sites call returns status code 401")
@@ -111,6 +109,6 @@ public class GetSitesSanityTests extends RestTest
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel).withParams("maxItems=1000")
.withCoreAPI().getSites();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -102,7 +102,6 @@ public class RemoveSiteMemberSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="MNT-16904")
@Test(groups = {TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY})
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that unauthenticated user is not able to delete site member")
@@ -111,6 +110,6 @@ public class RemoveSiteMemberSanityTests extends RestTest
restClient.authenticateUser(inexistentUser)
.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -100,7 +100,6 @@ public class UpdateSiteMemberSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that unauthenticated user is not able to update site member")
@@ -109,6 +108,6 @@ public class UpdateSiteMemberSanityTests extends RestTest
restClient.authenticateUser(inexistentUser);
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -13,7 +13,6 @@ 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.http.HttpStatus;
@@ -120,8 +119,7 @@ public class AddTagSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Verify user gets status code 401 if authentication call fails")
@Bug(id="MNT-16904")
TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Verify user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
public void userIsNotAbleToAddTagIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
@@ -129,6 +127,6 @@ public class AddTagSanityTests extends RestTest
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager);
restClient.withCoreAPI().usingResource(document).addTag("tagUnauthorized");
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -13,7 +13,6 @@ 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.http.HttpStatus;
@@ -119,15 +118,13 @@ public class AddTagsSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Verify user gets status code 401 if authentication call fails")
@Bug(id="MNT-16904")
@TestRail(section = { TestGroup.REST_API,TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Verify user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
public void userIsNotAbleToAddTagsIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager).withCoreAPI().usingResource(document).addTags(tag1, tag2);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -13,7 +13,6 @@ 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.http.HttpStatus;
@@ -117,8 +116,7 @@ public class DeleteTagSanityTests extends RestTest
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@Bug(id="MNT-16904")
@TestRail(section = { TestGroup.REST_API,
TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Verify user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
@@ -131,6 +129,6 @@ public class DeleteTagSanityTests extends RestTest
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager);
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -3,12 +3,15 @@ package org.alfresco.rest.tags;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.exception.JsonToModelConversionException;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestTagModelsCollection;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.*;
import org.alfresco.utility.model.FileModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -120,6 +123,6 @@ public class GetNodeTagsSanityTests extends RestTest
{
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.withCoreAPI().usingResource(document).getNodeTags();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -12,7 +12,6 @@ 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.http.HttpStatus;
@@ -108,7 +107,6 @@ public class GetTagSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Verify Manager user gets status code 401 if authentication call fails")
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
public void managerIsNotAbleToGetTagIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
@@ -121,7 +119,7 @@ public class GetTagSanityTests extends RestTest
managerUser.setPassword("wrongPassword");
restClient.authenticateUser(managerUser);
restClient.withCoreAPI().getTag(tag);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -8,8 +8,11 @@ import org.alfresco.utility.Utility;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.*;
import org.alfresco.utility.report.Bug;
import org.alfresco.utility.model.FileModel;
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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -105,7 +108,6 @@ public class GetTagsSanityTests extends RestTest
}
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Failed authentication get tags call returns status code 401 with Manager role")
@Bug(id = "MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
public void failedAuthenticationReturnsUnauthorizedStatus() throws JsonToModelConversionException, Exception
{
@@ -115,6 +117,6 @@ public class GetTagsSanityTests extends RestTest
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
restClient.authenticateUser(userModel);
restClient.withCoreAPI().getTags();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -10,6 +10,7 @@ import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.FileModel;
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,7 +104,6 @@ public class UpdateTagSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API,
TestGroup.TAGS }, executionType = ExecutionType.SANITY, description = "Verify user gets status code 401 if authentication call fails")
@Bug(id="MNT-16904")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
public void userIsNotAbleToUpdateTagIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
@@ -111,7 +111,6 @@ public class UpdateTagSanityTests extends RestTest
siteManager.setPassword("wrongPassword");
restClient.authenticateUser(siteManager);
restClient.withCoreAPI().usingTag(oldTag).update(randomTag);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastStatus().hasName(StatusModel.UNAUTHORIZED);
}
}
@@ -6,8 +6,6 @@ import java.util.List;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.dataprep.CMISUtil.Priority;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestSiteModel;
import org.alfresco.rest.model.RestTaskModel;
import org.alfresco.rest.model.RestTaskModelsCollection;
import org.alfresco.utility.model.FileModel;