Merge branch 'master' into TAS-2807

This commit is contained in:
Valentin Popa
2017-01-20 17:15:05 +02:00
44 changed files with 321 additions and 117 deletions
@@ -138,7 +138,7 @@ public class AddCommentCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION,
description = "Verify comment cannot be added if empty network ID is provided")
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.CORE })
public void addCommentUsingEmptyNetworkId() throws JsonToModelConversionException, Exception
{
@@ -101,7 +101,7 @@ 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")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToAddComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"));
@@ -95,7 +95,7 @@ public class DeleteCommentSanityTests extends RestTest
@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 })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void userIsNotAbleToDeleteCommentIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
@@ -100,7 +100,7 @@ public class GetCommentsSanityTests extends RestTest
@TestRail(section={TestGroup.REST_API, TestGroup.COMMENTS}, executionType= ExecutionType.SANITY,
description= "Verify Manager user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void managerIsNotAbleToRetrieveCommentIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
@@ -100,7 +100,7 @@ public class UpdateCommentSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user gets status code 401 on update comment call")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
@Bug(id="MNT-16904")
@Bug(id = "MNT-16904", description = "fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
@@ -87,7 +87,7 @@ public class AddFavoritesSanityTests extends RestTest
restPersonFavoritesModel.and().field("targetGuid").is(siteModel.getGuid());
}
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
description = "Verify Manager user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
@@ -157,7 +157,7 @@ public class DeleteFavoriteSanityTests extends RestTest
.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
@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 })
@@ -281,7 +281,7 @@ public class GetFavoriteSanityTests extends RestTest
description = "Verify user gets status code 401 if authentication call fails")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
@Bug(id = "MNT-16904", description = "fails only on environment with tenants")
public void userIsNotAbleToRetrieveFavoritesIfAuthenticationFails() throws JsonToModelConversionException, Exception
public void userIsNotAbleToRetrieveFavoriteSiteIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
siteManager.setPassword("wrongPassword");
@@ -185,7 +185,7 @@ public class GetFavoritesSanityTests extends RestTest
@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 })
@Bug(id = "MNT-16904", description = "fails only on environment with tenants")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void userIsNotAbleToRetrieveFavoritesIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
@@ -93,7 +93,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
@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)")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void managerUserNotAuthorizedFailsToAddFavoriteSite() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -125,7 +125,7 @@ public class DeleteSiteMembershipRequestSanityTests extends RestTest
@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")
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMmebershipRequest() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(dataUser.createRandomTestUser()).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
@@ -121,7 +121,7 @@ public class GetFavoriteSiteSanityTests extends RestTest
@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 gets its specific favorite site with Rest API when authentication fails (401)")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void managerUserNotAuthorizedFailsToGetFavoriteSite() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -109,7 +109,7 @@ public class GetFavoriteSitesSanityTests extends RestTest
@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)")
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void anyUserNotAuthenticatedIsNotAuthorizedToGetFavoriteSites() throws Exception
{
UserModel anyUser = dataUser.usingAdmin().createRandomTestUser();
@@ -105,7 +105,7 @@ public class GetPeoplePreferenceSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
@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)")
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "fails only on environment with tenants")
public void managerUserNotAuthorizedFailsToGetsAPreference() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -107,7 +107,7 @@ public class GetPeoplePreferencesSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
@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)")
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void managerUserGetsPeoplePreferencesIsNotAuthorized() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -51,7 +51,7 @@ public class GetSiteMembershipRequestCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify collaborator user fails to get all site membership requests of a specific person with Rest API when the authentication fails (401)")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthorizedCollaboratorUserFailsToGetSiteMembershipRequests() throws Exception
{
UserModel collaborator = dataUser.usingAdmin().createRandomTestUser();
@@ -64,7 +64,7 @@ public class GetSiteMembershipRequestCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify consumer user fails to get all site membership requests of a specific person with Rest API when the authentication fails (401)")
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void unauthorizedConsumerUserFailsToGetSiteMembershipRequests() throws Exception
{
UserModel consumer = dataUser.usingAdmin().createRandomTestUser();
@@ -92,7 +92,7 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user fails to get all site membership requests of a specific person with Rest API when the authentication fails (401)")
public void unauthorizedUserFailsToGetSiteMembershipRequests() throws Exception
{
@@ -80,7 +80,7 @@ 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")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserCannotRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI()
@@ -78,7 +78,7 @@ 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")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserCannotRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
{
UserModel inexistentUser = new UserModel("inexistent user", "wrong password");
@@ -15,7 +15,6 @@ 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.report.Bug;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils;
@@ -79,16 +78,20 @@ public class AddRatingCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Verify that if nodeId provided cannot be rated 405 status code is returned")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
@Bug(id = "MNT-16904")
public void likeResourceThatCannotBeRated() throws Exception
{
FolderModel folderModel = dataContent.usingUser(userModel).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(userModel).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
LinkModel link = dataLink.usingAdmin().usingSite(siteModel).createRandomLink();
document.setNodeRef(link.getNodeRef());
document.setNodeRef(link.getNodeRef().replace("workspace://SpacesStore/", "workspace%3A%2F%2FSpacesStore%2F"));
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError()
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, document.getNodeRef()))
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@TestRail(section = { TestGroup.REST_API,
@@ -117,7 +117,7 @@ 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")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToLikeDocument() throws Exception
{
FolderModel folderModel = dataContent.usingUser(userModel).usingSite(siteModel).createFolder();
@@ -201,7 +201,7 @@ public class AddRatingSanityTests extends RestTest
@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")
@Bug(id="MNT-16904", description = "fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToRateStarsToDocument() throws Exception
{
FolderModel folderModel = dataContent.usingUser(userModel).usingSite(siteModel).createFolder();
@@ -162,7 +162,7 @@ public class DeleteRatingSanityTests extends RestTest
@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 })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToDeleteRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
@@ -0,0 +1,199 @@
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.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.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang.RandomStringUtils;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class GetRatingFullTests extends RestTest
{
private SiteModel siteModel;
private UserModel adminUserModel, userModel;
private RestRatingModel returnedRatingModel;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws DataPreparationException
{
adminUserModel = dataUser.getAdminUser();
userModel = dataUser.createRandomTestUser();
siteModel = dataSite.usingAdmin().createPublicRandomSite();
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Check default error schema")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void checkDefaultErrorSchema() throws Exception
{
FileModel document = dataContent.usingSite(siteModel).usingAdmin().createContent(DocumentType.TEXT_PLAIN);
String randomNodeRef = RandomStringUtils.randomAlphanumeric(10);
document.setNodeRef(randomNodeRef);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, randomNodeRef))
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION,
description = "Get rating of a folder that has only stars")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getRatingOfFolderThatHasOnlyStars() throws Exception
{
FolderModel folder = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
restClient.authenticateUser(userModel).withCoreAPI().usingResource(folder).rateStarsToDocument(3);
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModel.assertThat().field("id").is("fiveStar")
.getAggregate().assertThat().field("numberOfRatings").is("1")
.assertThat().field("average").is("3.0");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION,
description = "Get rating of a folder that has both likes and stars")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getRatingOfFolderThatHasLikedAndStars() throws Exception
{
FolderModel folder = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
restClient.authenticateUser(userModel).withCoreAPI().usingResource(folder).rateStarsToDocument(3);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).likeDocument();
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModel.assertThat().field("id").is("fiveStar")
.getAggregate().assertThat().field("numberOfRatings").is("1")
.assertThat().field("average").is("3.0");
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getLikeRating();
restClient.assertStatusCodeIs(HttpStatus.OK);
returnedRatingModel.assertThat().field("id").is("likes")
.assertThat().field("myRating").is("true");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION,
description = "Get rating of a folder that has no ratings")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getRatingOfFolderThatHasNoRatings() throws Exception
{
FolderModel folder = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getFiveStarRating();
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0");
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getLikeRating();
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION,
description = "Get rating of a folder after rating was deleted")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getDeletedRatingOfAFolder() throws Exception
{
FolderModel folder = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
restClient.authenticateUser(userModel).withCoreAPI().usingResource(folder).rateStarsToDocument(3);
restClient.authenticateUser(userModel).withCoreAPI().usingResource(folder).deleteFiveStarRating();
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).likeDocument();
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).deleteLikeRating();
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getFiveStarRating();
returnedRatingModel.assertThat().field("id").is("fiveStar").getAggregate().assertThat().field("numberOfRatings").is("0")
.assertThat().field("average").isNull();
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getLikeRating();
returnedRatingModel.assertThat().field("id").is("likes").assertThat().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("0");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION,
description = "Get rating of a file after rating was deleted")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getDeletedRatingOfAFile() throws Exception
{
FileModel file = dataContent.usingUser(adminUserModel).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).rateStarsToDocument(3);
restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).deleteFiveStarRating();
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).likeDocument();
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).deleteLikeRating();
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getFiveStarRating();
returnedRatingModel.assertThat().field("id").is("fiveStar").getAggregate().assertThat().field("numberOfRatings").is("0")
.assertThat().field("average").isNull();
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getLikeRating();
returnedRatingModel.assertThat().field("id").is("likes").assertThat().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("0");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION,
description = "Get rating of another user as admin")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getRatingOfAnotherUserAsAdmin() throws Exception
{
FileModel file = dataContent.usingUser(adminUserModel).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).rateStarsToDocument(3);
restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).likeDocument();
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getFiveStarRating();
returnedRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("1").assertThat().field("average").is("3.0");
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getLikeRating();
returnedRatingModel.assertThat().field("id").is("likes").assertThat().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("1");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION,
description = "Get rating of admin with another user")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getRatingOfAdminWithAnotherUser() throws Exception
{
FileModel file = dataContent.usingUser(userModel).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).rateStarsToDocument(3);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).likeDocument();
returnedRatingModel = restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).getFiveStarRating();
returnedRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("1").assertThat().field("average").is("3.0");
returnedRatingModel = restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).getLikeRating();
returnedRatingModel.assertThat().field("id").is("likes").assertThat().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("1");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Get five star rating")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getFiveStarRating() throws Exception
{
FileModel file = dataContent.usingUser(userModel).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).getFiveStarRating();
returnedRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("1").assertThat().field("average").is("5.0");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Get one star rating")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.FULL })
public void getOneStarRating() throws Exception
{
FileModel file = dataContent.usingUser(userModel).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).rateStarsToDocument(1);
returnedRatingModel = restClient.authenticateUser(userModel).withCoreAPI().usingResource(file).getFiveStarRating();
returnedRatingModel.assertThat().field("id").is("fiveStar").and().field("myRating").isNull()
.getAggregate().assertThat().field("numberOfRatings").is("1").assertThat().field("average").is("1.0");
}
}
@@ -151,7 +151,7 @@ public class GetRatingSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve rating of a document")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToRetrieveRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
@@ -131,7 +131,7 @@ public class GetRatingsSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve document ratings")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToRetrieveRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
@@ -105,7 +105,7 @@ public class AddSiteMemberSanityTests extends RestTest
@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")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToAddSiteMmeber() throws Exception{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
@@ -101,7 +101,7 @@ public class GetSiteContainersSanityTests 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 containers call returns status code 401 with Manager role")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteContainers() throws JsonToModelConversionException, Exception
{
userModel = dataUser.createRandomTestUser();
@@ -100,7 +100,7 @@ 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")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteMember() throws JsonToModelConversionException, Exception
{
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
@@ -97,7 +97,7 @@ public class GetSiteMembersSanityTests 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 members call returns status code 401")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteMembers() throws JsonToModelConversionException, Exception
{
userModel = dataUser.createRandomTestUser();
@@ -105,7 +105,7 @@ public class GetSiteSanityTests 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 call returns status code 401")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToRetrieveSite() throws JsonToModelConversionException, Exception
{
userModel = dataUser.createRandomTestUser();
@@ -102,7 +102,7 @@ public class GetSitesSanityTests 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 sites call returns status code 401")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToRetrieveSites() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
@@ -117,7 +117,7 @@ public class RemoveSiteMemberSanityTests extends RestTest
@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")
@Bug(id = "MNT-16904")
@Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMember() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
@@ -103,7 +103,7 @@ public class UpdateSiteMemberSanityTests extends RestTest
@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")
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void unauthenticatedUserIsNotAuthorizedToUpdateSiteMmeber() throws Exception{
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser);
@@ -121,7 +121,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")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void userIsNotAbleToAddTagIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
@@ -120,7 +120,7 @@ public class AddTagsSanityTests extends RestTest
@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 })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void userIsNotAbleToAddTagsIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
@@ -120,7 +120,7 @@ public class DeleteTagSanityTests extends RestTest
@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 })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void userIsNotAbleToDeleteTagIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
@@ -12,6 +12,7 @@ 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.report.Bug;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
@@ -119,7 +120,7 @@ public class GetNodeTagsSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS },
executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to get node tags")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
// @Bug(id="MNT-16904")
@Bug(id = "MNT-16904", description = "fails only on environment with tenants")
public void unauthenticatedUserIsNotAbleToRetrieveNodeTags() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"));
@@ -109,7 +109,7 @@ 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")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void managerIsNotAbleToGetTagIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
String tagValue = RandomData.getRandomName("tag");
@@ -110,7 +110,7 @@ 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")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void failedAuthenticationReturnsUnauthorizedStatus() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
@@ -104,7 +104,7 @@ 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")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void userIsNotAbleToUpdateTagIfAuthenticationFails() throws JsonToModelConversionException, Exception
{
UserModel siteManager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
@@ -111,7 +111,7 @@ public class DeleteTaskVariableCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Delete task variable by inexistent user")
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void deleteTaskVarialbleByInexistentUser() throws Exception
{
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
@@ -122,7 +122,7 @@ public class RemoveTaskItemCoreTests extends RestTest
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Delete existing task item with inexistent user")
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void deleteTaskItemWithInexistentUser() throws Exception
{
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
@@ -157,7 +157,7 @@ public class UpdateTaskVariableCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
description = "Update task variable by inexistent user")
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
@Bug(id="MNT-16904")
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
public void updateTaskVariableByInexistentser() throws Exception
{
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");