fixed 3 tests and added one test to cover the new logged bug REPO-1889

This commit is contained in:
Cristina Axinte
2017-01-26 19:04:13 +02:00
parent ec7ed78029
commit 2942cf98d3
@@ -50,6 +50,9 @@ public class UpdateSiteMemberSanityTests extends RestTest
description = "Verify that collaborator is not able to update site member and gets status code FORBIDDEN (403)")
public void collaboratorIsNotAbleToUpdateSiteMember() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
@@ -58,11 +61,31 @@ public class UpdateSiteMemberSanityTests extends RestTest
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", siteModel.getTitle()));
}
@Bug(id = "REPO-1889")
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that collaborator is not able to update site member and gets status code FORBIDDEN (403)")
public void collaboratorIsNotAbleToUpdateSiteMemberWithTheSameRole() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
testUserModel.setUserRole(UserRole.SiteConsumer);
restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
restClient.assertLastError()
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", siteModel.getTitle()));
}
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
description = "Verify that contributor is not able to update site member and gets status code FORBIDDEN (403)")
public void contributorIsNotAbleToUpdateSiteMember() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);
@@ -76,6 +99,9 @@ public class UpdateSiteMemberSanityTests extends RestTest
description = "Verify that consumer is not able to update site member and gets status code FORBIDDEN (403)")
public void consumerIsNotAbleToUpdateSiteMember() throws Exception
{
UserModel testUserModel = dataUser.createRandomTestUser();
dataUser.addUserToSite(testUserModel, siteModel, UserRole.SiteConsumer);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
testUserModel.setUserRole(UserRole.SiteCollaborator);
restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUserModel);