test: mark @bug test for 5.2.N

This commit is contained in:
Paul Brodner
2016-12-14 18:22:50 +02:00
parent 23bf361238
commit 9f67e7b2ff
13 changed files with 220 additions and 137 deletions
@@ -11,6 +11,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;
@@ -114,6 +115,7 @@ public class AddCommentsSanityTests extends RestTest
@TestRail(section = { TestGroup.REST_API,
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user gets status code 401 on post multiple comments call")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.SANITY })
@Bug(id="MNT-16904")
public void unauthenticatedUserIsNotAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"))
@@ -11,13 +11,11 @@ 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.BeforeMethod;
import org.testng.annotations.Test;
public class AddSiteMembershipRequestCoreTests extends RestTest
{
private UserModel adminUser;
private UserModel newMember;
private UserModel adminUser;
private SiteModel siteModel;
@BeforeClass(alwaysRun = true)
@@ -27,16 +25,13 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
siteModel = dataSite.usingUser(adminUser).createModeratedRandomSite();
}
@BeforeMethod
public void setUp() throws DataPreparationException
{
newMember = dataUser.createRandomTestUser();
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify addSiteMembershipRequest Rest API status code is 400 for a user that has already been invited")
public void addSiteMembershipRequestStatusCodeIs400ReceivedForAUserThatIsAlreadyInvited() throws Exception
{
UserModel newMember = dataUser.createRandomTestUser();
dataUser.addUserToSite(newMember, siteModel, UserRole.SiteContributor);
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
@@ -47,6 +42,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify addSiteMembershipRequest Rest API status code is 404 for a user that does not exist")
public void addSiteMembershipRequestStatusCodeIs404ReceivedForAUserThatDoesNotExist() throws Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember).withCoreAPI().usingUser(new UserModel("invalidUser", "password")).addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
restClient.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidUser"));
@@ -56,6 +52,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify addSiteMembershipRequest Rest API status code is 404 for a site that does not exist")
public void addSiteMembershipRequestStatusCodeIs404ReceivedForASiteThatDoesNotExist() throws Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(new SiteModel("invalidSiteID"));
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
restClient.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), "invalidSiteID"));
@@ -65,6 +62,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify addSiteMembershipRequest Rest API status code is 400 for empty request body")
public void addSiteMembershipRequestStatusCodeIs400ForEmptyRequestBody() throws Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest("");
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
}
@@ -73,6 +71,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify addSiteMembershipRequest Rest API status code is 201 for request with empty message")
public void addSiteMembershipRequestStatusCodeIs201ForRequestWithEmptyMessage() throws Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest("", siteModel, "New request");
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -81,6 +80,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify addSiteMembershipRequest Rest API status code is 201 for request with empty title")
public void addSiteMembershipRequestStatusCodeIs201ForRequestWithEmptyTitle() throws Exception
{
UserModel newMember = dataUser.createRandomTestUser();
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest("Please accept me", siteModel, "");
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -36,8 +36,9 @@ 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 contributor user fails to get all site membership requests of a specific person with Rest API when the authentication fails (401)")
@Bug(id="16904")
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify contributor user fails to get all site membership requests of a specific person with Rest API when the authentication fails (401)")
@Bug(id = "16904")
public void unauthorizedContributorUserFailsToGetSiteMembershipRequests() throws Exception
{
UserModel contributor = dataUser.usingAdmin().createRandomTestUser();
@@ -48,7 +49,9 @@ 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)")
@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")
public void unauthorizedCollaboratorUserFailsToGetSiteMembershipRequests() throws Exception
{
UserModel collaborator = dataUser.usingAdmin().createRandomTestUser();
@@ -59,7 +62,9 @@ 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)")
@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")
public void unauthorizedConsumerUserFailsToGetSiteMembershipRequests() throws Exception
{
UserModel consumer = dataUser.usingAdmin().createRandomTestUser();
@@ -70,7 +75,8 @@ 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 a user gets all its own site membership requests using '-me-' with Rest API and response is successful (200)")
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify a user gets all its own site membership requests using '-me-' with Rest API and response is successful (200)")
public void usingMeGetSiteMembershipRequestsWithSuccess() throws Exception
{
restClient.authenticateUser(newMember).withCoreAPI().usingMe().getSiteMembershipRequest(siteModel).assertThat().field("id").is(siteModel.getId());
@@ -78,7 +84,8 @@ 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 site manager can't get site membership requests for inexistent user and response is not found (404)")
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager can't get site membership requests for inexistent user and response is not found (404)")
public void siteManagerCantGetSiteMembershipRequestsInexistentUser() throws Exception
{
restClient.authenticateUser(newMember).withCoreAPI().usingUser(UserModel.getRandomUserModel()).getSiteMembershipRequest(siteModel);
@@ -86,7 +93,8 @@ 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 user can get site membership requests on site with no requests and response is successful (200)")
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user can get site membership requests on site with no requests and response is successful (200)")
public void userCantGetSiteMembershipRequestsWithNoRequests() throws Exception
{
UserModel noRequestUser = dataUser.createRandomTestUser();
@@ -96,7 +104,8 @@ 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 site manager can't get site membership requests on public site and response is not found (404)")
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager can't get site membership requests on public site and response is not found (404)")
public void siteManagerCantGetPublicSiteMembershipRequests() throws Exception
{
UserModel publicUser = dataUser.createRandomTestUser();
@@ -108,7 +117,8 @@ 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 site manager can't get site membership requests on private site and response is not found (404)")
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager can't get site membership requests on private site and response is not found (404)")
public void siteManagerCantGetPrivateSiteMembershipRequests() throws Exception
{
UserModel privateUser = dataUser.createRandomTestUser();
@@ -120,7 +130,8 @@ 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 site manager can't get site membership requests for inexistent site and response is not found (404)")
@TestRail(section = { TestGroup.REST_API,
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager can't get site membership requests for inexistent site and response is not found (404)")
public void siteManagerCantGetSiteMembershipRequestsForInexistentSite() throws Exception
{
SiteModel inexistentSite = SiteModel.getRandomSiteModel();
@@ -17,7 +17,6 @@ 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.BeforeMethod;
import org.testng.annotations.Test;
public class DeleteRatingCoreTests extends RestTest
@@ -25,8 +24,7 @@ public class DeleteRatingCoreTests extends RestTest
private SiteModel siteModel;
private UserModel adminUser;
private FolderModel folderModel;
private FileModel document;
private ListUserWithRoles usersWithRoles;
private RestRatingModel returnedRatingModel;
@@ -40,18 +38,13 @@ public class DeleteRatingCoreTests extends RestTest
UserRole.SiteContributor);
}
@BeforeMethod()
public void setUp() throws DataPreparationException, Exception
{
folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Verify that if ratingId provided is unknown status code returned is 400")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
public void deleteInvalidRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(document).deleteInvalidRating("random_rating");
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_RATING, "random_rating"));
}
@@ -61,6 +54,8 @@ public class DeleteRatingCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
public void deleteRatingUsingInvalidDocument() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
document.setNodeRef("random_value");
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "random_value"));
@@ -72,6 +67,8 @@ public class DeleteRatingCoreTests extends RestTest
@Bug(id = "MNT-17181")
public void deleteStarsForANotRatedDocument() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
@@ -82,6 +79,8 @@ public class DeleteRatingCoreTests extends RestTest
@Bug(id = "MNT-17181")
public void deleteLikeForANotLikedDocument() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
@@ -91,6 +90,8 @@ public class DeleteRatingCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
public void likeDocumentAfterLikeRatingIsDeleted() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(document).likeDocument();
restClient.withCoreAPI().usingResource(document).deleteLikeRating();
returnedRatingModel = restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -105,6 +106,9 @@ public class DeleteRatingCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
public void addStarsToDocumentAfterRatingIsDeleted() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.withCoreAPI().usingResource(document).deleteFiveStarRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
@@ -121,6 +125,9 @@ public class DeleteRatingCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
public void deleteDocumentRatingUsingManager() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(document).rateStarsToDocument(5);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(document).likeDocument();
@@ -136,6 +143,9 @@ public class DeleteRatingCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
public void deleteLikeOfAnotherUser() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingResource(document).likeDocument();
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingResource(document).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
@@ -17,16 +17,12 @@ 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.BeforeMethod;
import org.testng.annotations.Test;
public class GetRatingSanityTests extends RestTest
{
private SiteModel siteModel;
private UserModel adminUser;
private FolderModel folderModel;
private FileModel document;
private UserModel adminUser;
private ListUserWithRoles usersWithRoles;
private RestRatingModel restRatingModel;
@@ -40,18 +36,14 @@ public class GetRatingSanityTests extends RestTest
UserRole.SiteContributor);
}
@BeforeMethod()
public void setUp() throws DataPreparationException, Exception
{
folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Manager role is able to retrieve rating of a document")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void managerIsAbleToRetrieveRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -71,6 +63,9 @@ public class GetRatingSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void collaboratorIsAbleToRetrieveRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -90,6 +85,9 @@ public class GetRatingSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void contributorIsAbleToRetrieveRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -109,6 +107,9 @@ public class GetRatingSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void consumerIsAbleToRetrieveRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -128,6 +129,9 @@ public class GetRatingSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void adminIsAbleToRetrieveRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
document = dataContent.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(folderModel)
.createContent(DocumentType.TEXT_PLAIN);
@@ -150,6 +154,9 @@ public class GetRatingSanityTests extends RestTest
@Bug(id = "MNT-16904")
public void unauthenticatedUserIsNotAbleToRetrieveRating() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser);
restClient.withCoreAPI().usingResource(document).likeDocument();
restClient.withCoreAPI().usingResource(document).rateStarsToDocument(5);
@@ -12,19 +12,17 @@ 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.report.Bug;
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.BeforeMethod;
import org.testng.annotations.Test;
public class GetRatingsSanityTests extends RestTest
{
private SiteModel siteModel;
private UserModel adminUser;
private FolderModel folderModel;
private FileModel document;
private UserModel adminUser;
private ListUserWithRoles usersWithRoles;
private RestRatingModelsCollection restRatingModelsCollection;
@@ -38,18 +36,14 @@ public class GetRatingsSanityTests extends RestTest
UserRole.SiteContributor);
}
@BeforeMethod()
public void setUp() throws DataPreparationException, Exception
{
folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Manager is able to retrieve document ratings")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void managerIsAbleToRetrieveDocumentRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -65,6 +59,9 @@ public class GetRatingsSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void collaboratorIsAbleToRetrieveDocumentRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -80,6 +77,9 @@ public class GetRatingsSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void contributorIsAbleToRetrieveDocumentRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -95,6 +95,9 @@ public class GetRatingsSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void consumerIsAbleToRetrieveDocumentRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.withCoreAPI().usingResource(document).likeDocument();
@@ -110,6 +113,9 @@ public class GetRatingsSanityTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
public void adminIsAbleToRetrieveDocumentRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
document = dataContent.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(folderModel)
.createContent(DocumentType.TEXT_PLAIN);
@@ -125,8 +131,12 @@ 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")
public void unauthenticatedUserIsNotAbleToRetrieveRatings() throws Exception
{
FolderModel folderModel = dataContent.usingUser(adminUser).usingSite(siteModel).createFolder();
FileModel document = dataContent.usingUser(adminUser).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUser);
restClient.withCoreAPI().usingResource(document).likeDocument();
restClient.withCoreAPI().usingResource(document).rateStarsToDocument(5);
@@ -7,7 +7,6 @@ import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.rest.model.RestSiteMemberModel;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.exception.DataPreparationException;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
@@ -16,13 +15,11 @@ import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class AddSiteMemberCoreTests extends RestTest
{
private UserModel adminUserModel;
private UserModel testUser;
private SiteModel publicSiteModel;
private SiteModel moderatedSiteModel;
private SiteModel privateSiteModel;
@@ -45,17 +42,14 @@ public class AddSiteMemberCoreTests extends RestTest
addMembersJson = "{\"role\":\"%s\",\"id\":\"%s\"}, {\"role\":\"%s\",\"id\":\"%s\"}";
}
@BeforeMethod
public void setUp() throws DataPreparationException {
testUser = dataUser.createRandomTestUser("testUser");
}
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.CORE })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
description = "Verify that manager can add another user as manager to a public site and gets status code CREATED (201)")
public void addManagerToPublicSite() throws Exception
{
testUser.setUserRole(UserRole.SiteManager);
UserModel testUser = dataUser.createRandomTestUser("testUser");
memberModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
memberModel.assertThat().field("id").is(testUser.getUsername())
@@ -67,6 +61,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that manager can add another user as manager to a moderated site and gets status code CREATED (201)")
public void addManagerToModeratedSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager);
memberModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -79,6 +74,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that manager can add another user as manager to a private site and gets status code CREATED (201)")
public void addManagerToPrivateSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager);
memberModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -91,6 +87,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that consumer role is not able to add another user to a moderated site and gets status code 403")
public void addUserByConsumerToModeratedSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRolesToModeratedSite.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingSite(moderatedSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -101,6 +98,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that consumer role is not able to add another user to a private site and gets status code 403")
public void addUserByConsumerToPrivateSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRolesToPrivateSite.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingSite(privateSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -111,6 +109,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that collaborator role is not able to add another user to a moderated site and gets status code 403")
public void addUserByCollaboratorToModeratedSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRolesToModeratedSite.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingSite(moderatedSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -121,6 +120,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that collaborator role is not able to add another user to a private site and gets status code 403")
public void addUserByCollaboratorToPrivateSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRolesToPrivateSite.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingSite(privateSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -131,6 +131,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that contributor role is not able to add another user to a moderated site and gets status code 403")
public void addUserByContributorToModeratedSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRolesToModeratedSite.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingSite(moderatedSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -140,7 +141,8 @@ public class AddSiteMemberCoreTests extends RestTest
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
description = "Verify that contributor role is not able to add another user to a private site and gets status code 403")
public void addUserByContributorToPrivateSite() throws Exception
{
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRolesToPrivateSite.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingSite(privateSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -151,6 +153,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that a user without specified role can not be added to a site and gets status code 400")
public void canNotAddUserWithoutSpecifyingRoleToSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
restClient.authenticateUser(adminUserModel).withCoreAPI();
String json = JsonBodyGenerator.keyValueJson("id", testUser.getUsername());
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
@@ -163,6 +166,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that a user with inexistent role can not be added to a site and gets status code 400")
public void canNotAddUserWithInexistentRoleToSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
restClient.authenticateUser(adminUserModel).withCoreAPI();
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, String.format("{\"role\":\"inexistentRole\",\"id\":\"%s\"}", testUser.getUsername()), "sites/{siteId}/members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
restClient.processModel(RestSiteMemberModel.class, request);
@@ -174,6 +178,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that user can not add himself as a manager to a public site and gets status code 403")
public void userAddHimselfAsManagerToPublicSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager);
restClient.authenticateUser(testUser).withCoreAPI().usingSite(publicSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -184,6 +189,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that user can not add himself as a manager to a moderated site and gets status code 403")
public void userAddHimselfAsManagerToModeratedSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager);
restClient.authenticateUser(testUser).withCoreAPI().usingSite(moderatedSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -194,6 +200,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that user can not add himself as a manager to a private site and gets status code 404")
public void userAddHimselfAsManagerToPrivateSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager);
restClient.authenticateUser(testUser).withCoreAPI().usingSite(privateSiteModel).addPerson(testUser);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, privateSiteModel.getId()));
@@ -204,6 +211,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that user can not be added to an inexistent site and gets status code 404")
public void userIsNotAbleToAddUserToAnInexistentSite() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager);
SiteModel inexistentSite = new SiteModel("inexistentSite");
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(inexistentSite).addPerson(testUser);
@@ -215,6 +223,7 @@ public class AddSiteMemberCoreTests extends RestTest
description = "Verify that user can not be added to a site if an empty site id is provided and gets status code 404")
public void userIsNotAbleToAddAnotherUserUsingEmptySiteId() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager);
SiteModel inexistentSite = new SiteModel("");
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(inexistentSite).addPerson(testUser);
@@ -12,104 +12,119 @@ 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.BeforeMethod;
import org.testng.annotations.Test;
/**
* @author iulia.cojocea
*/
public class RemoveSiteMemberSanityTests extends RestTest
{
{
private SiteModel siteModel;
private UserModel adminUserModel;
private ListUserWithRoles usersWithRoles;
private UserModel testUserModel;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws DataPreparationException{
public void dataPreparation() throws DataPreparationException
{
adminUserModel = dataUser.getAdminUser();
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator,
UserRole.SiteConsumer, UserRole.SiteContributor);
}
@BeforeMethod
public void addUserToSite() throws DataPreparationException{
testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
UserRole.SiteContributor);
}
@Test(groups = {TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY})
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that site manager can delete site member and gets status code 204, 'No Content'")
public void siteManagerIsAbleToDeleteSiteMemberWithConsumerRole() throws Exception{
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API,
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that site manager can delete site member and gets status code 204, 'No Content'")
public void siteManagerIsAbleToDeleteSiteMemberWithConsumerRole() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().getSites().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="ACE-5444")
@Test(groups = {TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY})
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that site collaborator cannot delete site member and gets status code 403, 'Forbidden'")
public void siteCollaboratorIsNotAbleToDeleteSiteMemberWithConsumerRole() throws Exception{
@Bug(id = "ACE-5444")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API,
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that site collaborator cannot delete site member and gets status code 403, 'Forbidden'")
public void siteCollaboratorIsNotAbleToDeleteSiteMemberWithConsumerRole() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.withCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="ACE-5444")
@Test(groups = {TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY})
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that site contributor cannot delete site member and gets status code 403, 'Forbidden'")
public void siteContributorIsNotAbleToDeleteSiteMemberWithConsumerRole() throws Exception{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.withCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id="ACE-5444")
@Test(groups = {TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY})
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that site consumer cannot delete site member and gets status code 403, 'Forbidden'")
public void siteConsumerIsNotAbleToDeleteSiteMemberWithConsumerRole() throws Exception{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.withCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Test(groups = {TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY})
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that admin user can delete site member and gets status code 204, 'No Content'")
public void adminUserIsAbleToDeleteSiteMember() throws Exception{
restClient.authenticateUser(adminUserModel)
.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
@Bug(id = "ACE-5444")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API,
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that site contributor cannot delete site member and gets status code 403, 'Forbidden'")
public void siteContributorIsNotAbleToDeleteSiteMemberWithConsumerRole() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.withCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Bug(id = "ACE-5444")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API,
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that site consumer cannot delete site member and gets status code 403, 'Forbidden'")
public void siteConsumerIsNotAbleToDeleteSiteMemberWithConsumerRole() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingSite(siteModel)
.deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
restClient.withCoreAPI().getSites().assertThat().entriesListContains("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API,
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that admin user can delete site member and gets status code 204, 'No Content'")
public void adminUserIsAbleToDeleteSiteMember() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().getSites().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername());
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@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")
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMember() throws Exception{
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser)
.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
@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")
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMember() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
restClient.authenticateUser(inexistentUser).withCoreAPI().usingSite(siteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
}
}
@@ -15,14 +15,13 @@ import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class DeleteTagCoreTests extends RestTest
{
private UserModel adminUserModel, userModel;
private SiteModel siteModel;
private RestTagModel tag;
private UserModel adminUserModel;
private UserModel userModel;
private SiteModel siteModel;
private FileModel document;
private FolderModel folderModel;
@@ -36,17 +35,14 @@ public class DeleteTagCoreTests extends RestTest
folderModel = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
}
@BeforeMethod
public void setUp() throws Exception {
restClient.authenticateUser(adminUserModel);
tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
}
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
description = "Verify that if user has no permission to remove tag returned status code is 403")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
public void deleteTagWithUserWithoutPermission() throws Exception
{
restClient.authenticateUser(adminUserModel);
RestTagModel tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
restClient.authenticateUser(userModel);
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
@@ -57,6 +53,9 @@ public class DeleteTagCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
public void deleteTagForAnInexistentNode() throws Exception
{
restClient.authenticateUser(adminUserModel);
RestTagModel tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
FileModel document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
String nodeRef = RandomStringUtils.randomAlphanumeric(10);
document.setNodeRef(nodeRef);
@@ -69,6 +68,9 @@ public class DeleteTagCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
public void deleteTagThatDoesNotExist() throws Exception
{
restClient.authenticateUser(adminUserModel);
RestTagModel tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
tag.setId("abc");
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "abc"));
@@ -79,6 +81,9 @@ public class DeleteTagCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
public void deleteTagWithEmptyId() throws Exception
{
restClient.authenticateUser(adminUserModel);
RestTagModel tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
tag.setId("");
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError().containsSummary(RestErrorModel.DELETE_EMPTY_ARGUMENT);
@@ -89,6 +94,9 @@ public class DeleteTagCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
public void deleteFileTag() throws Exception
{
restClient.authenticateUser(adminUserModel);
RestTagModel tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingResource(document).getNodeTags()
@@ -100,6 +108,9 @@ public class DeleteTagCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
public void deleteFolderTag() throws Exception
{
restClient.authenticateUser(adminUserModel);
RestTagModel tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
tag = restClient.withCoreAPI().usingResource(folderModel).addTag(RandomData.getRandomName("tag"));
restClient.withCoreAPI().usingResource(folderModel).deleteTag(tag);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
@@ -11,6 +11,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.apache.commons.lang.RandomStringUtils;
@@ -87,10 +88,11 @@ public class GetProcessVariablesCoreTests extends RestTest
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
description = "Get process variables using empty process ID")
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
@Bug(id="AUTOMATION", description="Please fix this automated test")
public void getProcessVariablesUsingEmptyProcessId() throws JsonToModelConversionException, Exception
{
processModel = restClient.authenticateUser(userWhoStartsTask).withParams("maxItems=2").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processModel.setId(" ");
processModel.setId(" /");
variables = restClient.withWorkflowAPI().usingProcess(processModel).getProcessVariables();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, " "));
}
@@ -9,6 +9,7 @@ import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
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;
@@ -110,6 +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")
public void deleteTaskVarialbleByInexistentUser() throws Exception
{
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
@@ -11,6 +11,7 @@ import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
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;
@@ -121,6 +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")
public void deleteTaskItemWithInexistentUser() throws Exception
{
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
@@ -9,6 +9,7 @@ import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
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;
@@ -156,6 +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")
public void updateTaskVariableByInexistentser() throws Exception
{
variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");