mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch '@TestChanges' of https://gitlab.alfresco.com/tas/alfresco-tas-restapi-test
# Conflicts: # src/test/java/org/alfresco/rest/people/DeleteSiteMembershipRequestCoreTests.java # src/test/java/org/alfresco/rest/people/GetSiteMembershipRequestsCoreTests.java
This commit is contained in:
@@ -14,7 +14,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class AddFavoriteSiteSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -26,9 +25,10 @@ public class AddFavoriteSiteSanityTests extends RestTest
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user add a favorite site with Rest API and response is successful (201)")
|
||||
public void managerUserAddFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
@@ -38,12 +38,13 @@ public class AddFavoriteSiteSanityTests extends RestTest
|
||||
restFavoriteSiteModel = restClient.authenticateUser(managerUser).withCoreAPI().usingUser(managerUser).addFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restFavoriteSiteModel.assertThat().field("id").is(siteModel.getId());
|
||||
|
||||
|
||||
restClient.withCoreAPI().usingUser(managerUser).addFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT);
|
||||
restClient.assertLastError().containsSummary(String.format("%s is already a favourite site", siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT);
|
||||
restClient.assertLastError().containsSummary(String.format("%s is already a favourite site", siteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user add a favorite site with Rest API and response is successful (201)")
|
||||
public void collaboratorUserAddFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
@@ -55,17 +56,19 @@ public class AddFavoriteSiteSanityTests extends RestTest
|
||||
restFavoriteSiteModel.assertThat().field("id").is(siteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user add a favorite site with Rest API and response is successful (201)")
|
||||
public void contributorUserAddFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
|
||||
|
||||
restFavoriteSiteModel = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().addFavoriteSite(siteModel);
|
||||
restFavoriteSiteModel = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().addFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restFavoriteSiteModel.assertThat().field("id").is(siteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user add a favorite site with Rest API and response is successful (201)")
|
||||
public void consumerUserAddFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
@@ -77,6 +80,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
|
||||
restFavoriteSiteModel.assertThat().field("id").is(siteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user add a favorite site with Rest API and response is successful (201)")
|
||||
public void adminUserAddFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
@@ -87,6 +91,7 @@ public class AddFavoriteSiteSanityTests extends RestTest
|
||||
restFavoriteSiteModel.assertThat().field("id").is(siteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify a manager user is NOT Authorized to add a favorite site with Rest API when authentication fails (401)")
|
||||
public void managerUserNotAuthorizedFailsToAddFavoriteSite() throws Exception
|
||||
|
||||
@@ -14,14 +14,13 @@ import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public class AddSiteMembershipRequestCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser;
|
||||
private UserModel newMember;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
@@ -34,68 +33,55 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
|
||||
newMember = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@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")
|
||||
@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
|
||||
{
|
||||
dataUser.addUserToSite(newMember, siteModel, UserRole.SiteContributor);
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingMe()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.ALREADY_Site_MEMBER, newMember.getUsername(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@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")
|
||||
@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 404 for a user that does not exist")
|
||||
public void addSiteMembershipRequestStatusCodeIs404ReceivedForAUserThatDoesNotExist() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingUser(new UserModel("invalidUser", "password")).addSiteMembershipRequest(siteModel);
|
||||
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"));
|
||||
}
|
||||
|
||||
@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")
|
||||
@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 404 for a site that does not exist")
|
||||
public void addSiteMembershipRequestStatusCodeIs404ReceivedForASiteThatDoesNotExist() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingMe().addSiteMembershipRequest(new SiteModel("invalidSiteID"));
|
||||
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"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify addSiteMembershipRequest Rest API status code is 400 for empty request body")
|
||||
@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 empty request body")
|
||||
public void addSiteMembershipRequestStatusCodeIs400ForEmptyRequestBody() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingMe().addSiteMembershipRequest("");
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest("");
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify addSiteMembershipRequest Rest API status code is 201 for request with empty message")
|
||||
@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 201 for request with empty message")
|
||||
public void addSiteMembershipRequestStatusCodeIs201ForRequestWithEmptyMessage() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingMe().addSiteMembershipRequest("", siteModel, "New request");
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest("", siteModel, "New request");
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify addSiteMembershipRequest Rest API status code is 201 for request with empty title")
|
||||
@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 201 for request with empty title")
|
||||
public void addSiteMembershipRequestStatusCodeIs201ForRequestWithEmptyTitle() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingMe().addSiteMembershipRequest("Please accept me", siteModel, "");
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest("Please accept me", siteModel, "");
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,8 @@ import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
{
|
||||
{
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
@@ -38,93 +37,81 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
private UserModel newMember;
|
||||
private RestSiteMembershipRequestModel requestModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() throws DataPreparationException {
|
||||
public void setUp() throws DataPreparationException
|
||||
{
|
||||
newMember = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site manager is able to create new site membership request")
|
||||
@Bug(id="MNT-16557")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site manager is able to create new site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteManagerIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
requestModel.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
requestModel.assertThat().field("id").isNotEmpty().assertThat().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site collaborator is able to create new site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site collaborator is able to create new site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteCollaboatorIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
requestModel.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
requestModel.assertThat().field("id").isNotEmpty().assertThat().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site contributor is able to create new site membership request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site contributor is able to create new site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteContributorIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
requestModel.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
requestModel.assertThat().field("id").isNotEmpty().assertThat().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site consumer is able to create new site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is able to create new site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteConsumerIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
requestModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
requestModel.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
requestModel.assertThat().field("id").isNotEmpty().assertThat().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user is able to create new site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to create new site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void adminUserIsAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
requestModel = restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
requestModel = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
requestModel.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
requestModel.assertThat().field("id").isNotEmpty().assertThat().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify unauthenticated user is not able to create new site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to create new site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void unauthenticatedUserIsNotAbleToCreateSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -29,9 +28,9 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)")
|
||||
public void removeFavoriteSiteWithSuccessUsingMeAsPersonId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
@@ -41,18 +40,18 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify inexistent user is not able to remove a site from favorites and response is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@Bug(id = "REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify inexistent user is not able to remove a site from favorites and response is 404")
|
||||
public void inexistentUserIsNotAbleToRemoveFavoriteSite() throws Exception
|
||||
{
|
||||
UserModel inexistentUser = new UserModel("inexistenUser", "password");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(inexistentUser).removeFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "inexistenUser"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404")
|
||||
public void userIsNotAbleToRemoveFavoriteSiteWithInexistentId() throws Exception
|
||||
{
|
||||
SiteModel inexistentSite = new SiteModel("inexistentSite");
|
||||
@@ -60,9 +59,9 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, adminUserModel.getUsername(), inexistentSite.getTitle()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager user removes a site from its favorites and adds it again and response is successful (204)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify manager user removes a site from its favorites and adds it again and response is successful (204)")
|
||||
public void managerUserRemovesFavoriteSiteAndAddItAgain() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -74,9 +73,9 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
restClient.withCoreAPI().usingUser(managerUser).addFavoriteSite(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void managerUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -87,41 +86,41 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites().assertThat().entriesListDoesNotContain("id", siteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.PEOPLE}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify uninvited user can delete favorite public site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify uninvited user can delete favorite public site and response is 204")
|
||||
public void uninvitedUserCanDeleteFavoritePublicSite() throws Exception
|
||||
{
|
||||
{
|
||||
SiteModel publicSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).addFavoriteSite(publicSiteModel);
|
||||
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", publicSiteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.PEOPLE}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify uninvited user can delete favorite moderated site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify uninvited user can delete favorite moderated site and response is 204")
|
||||
public void uninvitedUserCanDeleteFavoriteModeratedSite() throws Exception
|
||||
{
|
||||
{
|
||||
SiteModel moderatedSiteModel = dataSite.usingUser(adminUserModel).createModeratedRandomSite();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).addFavoriteSite(moderatedSiteModel);
|
||||
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(moderatedSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", moderatedSiteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.PEOPLE}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify user can delete favorite private site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user can delete favorite private site and response is 204")
|
||||
public void userCanDeleteFavoritePrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSiteModel = dataSite.usingUser(userModel).createPrivateRandomSite();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).addFavoriteSite(privateSiteModel);
|
||||
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().removeFavoriteSite(privateSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingAuthUser().getFavoriteSites().assertThat().entriesListDoesNotContain("id", privateSiteModel.getId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import org.testng.annotations.Test;
|
||||
/**
|
||||
* @author Cristina Axinte
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
|
||||
public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -30,9 +30,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
siteModel2 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void managerUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -44,9 +43,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void collaboratorUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -58,9 +56,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void contributorUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -72,9 +69,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user removes a site from its favorite sites list with Rest API and response is successful (204)")
|
||||
public void consumerUserRemovesFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -86,9 +82,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user removes a site from any user's favorite sites list with Rest API and response is successful (204)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user removes a site from any user's favorite sites list with Rest API and response is successful (204)")
|
||||
public void adminUserRemovesAnyFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
@@ -100,9 +95,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify a user removes a site from another user's favorite sites list with Rest API and response is permission denied (403)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify a user removes a site from another user's favorite sites list with Rest API and response is permission denied (403)")
|
||||
public void userUserRemovesAnotherUserFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel userAuth = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -114,10 +108,9 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)")
|
||||
public void managerUserNotAuthorizedFailsToRemoveFavoriteSite() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public class DeleteSiteMemberCoreTests extends RestTest
|
||||
{
|
||||
private UserModel userModel;
|
||||
@@ -37,147 +36,156 @@ public class DeleteSiteMemberCoreTests extends RestTest
|
||||
moderatedSiteModel = dataSite.usingUser(adminUserModel).createModeratedRandomSite();
|
||||
privateSiteModel = dataSite.usingUser(adminUserModel).createPrivateRandomSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user removes a site member using '-me-' in place of personId and response is successful (204)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user removes a site member using '-me-' in place of personId and response is successful (204)")
|
||||
public void removeSiteMemberWithSuccessUsingMeAsPersonId() throws Exception
|
||||
{
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel);
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingMe().deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can't remove a site membership if doesn't have access to personId and response is 422")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user can't remove a site membership if doesn't have access to personId and response is 422")
|
||||
public void notAbleToRemoveSiteMemberWithNoAccessToPersonId() throws Exception
|
||||
{
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
dataSite.usingUser(user).createPublicRandomSite();
|
||||
|
||||
|
||||
userModel.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel);
|
||||
|
||||
restClient.authenticateUser(user).withCoreAPI().usingUser(userModel).deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can't remove a site membership of an inexistent uer and response is 404")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user can't remove a site membership of an inexistent uer and response is 404")
|
||||
public void userIsNotAbleToRemoveInexistentSiteMember() throws Exception
|
||||
{
|
||||
{
|
||||
UserModel inexistentUser = new UserModel("inexistenUser", "password");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(inexistentUser).deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentUser.getUsername()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentUser.getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove a member of an inexistent site and response is 404")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove a member of an inexistent site and response is 404")
|
||||
public void userIsNotAbleToRemoveMembershipOfInexistentSite() throws Exception
|
||||
{
|
||||
SiteModel inexistentSite = new SiteModel("inexistentSite");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(inexistentSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), inexistentSite.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), inexistentSite.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove a member of an empty site id and response is 404")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove a member of an empty site id and response is 404")
|
||||
public void userIsNotAbleToRemoveMembershipOfEmptySiteId() throws Exception
|
||||
{
|
||||
SiteModel inexistentSite = new SiteModel("");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(inexistentSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError().containsSummary(RestErrorModel.DELETE_EMPTY_ARGUMENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove a regular member of a public site and response is 422")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove a regular member of a public site and response is 422")
|
||||
public void regularUserIsNotAbleToRemoveRegularUserSiteMembershipFromPublicSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(secondUserModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(secondUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove a regular member a moderated site and response is 422")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove a regular member a moderated site and response is 422")
|
||||
public void regularUserIsNotAbleToRemoveRegularUserSiteMembershipFromModeratedSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(secondUserModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(secondUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(moderatedSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove a regular member of a private site and response is 422")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove a regular member of a private site and response is 422")
|
||||
public void regularUserIsNotAbleToRemoveRegularUserSiteMembershipFromPrivateSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(secondUserModel);
|
||||
restClient.authenticateUser(secondUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(privateSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to remove a regular member of a public site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify admin is able to remove a regular member of a public site and response is 204")
|
||||
public void adminIsAbleToRemoveRegularUserSiteMembershipFromPublicSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to remove a regular member of a moderated site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify admin is able to remove a regular member of a moderated site and response is 204")
|
||||
public void adminIsAbleToRemoveRegularUserSiteMembershipFromModeratedSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(moderatedSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to remove a regular member of a private site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify admin is able to remove a regular member of a private site and response is 204")
|
||||
public void adminIsAbleToRemoveRegularUserSiteMembershipFromPrivateSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(userModel).deleteSiteMember(privateSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove admin membership from public site and response is 422")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove admin membership from public site and response is 422")
|
||||
public void regularUserIsNotAbleToRemoveAdminSiteMembershipFromPublicSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(managerModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove admin membership from moderated site and response is 422")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove admin membership from moderated site and response is 422")
|
||||
public void regularUserIsNotAbleToRemoveAdminSiteMembershipFromModeratedSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addPerson(managerModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(moderatedSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to remove admin membership from private site and response is 422")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove admin membership from private site and response is 422")
|
||||
public void regularUserIsNotAbleToRemoveAdminSiteMembershipFromPrivateSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(managerModel);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).addPerson(userModel);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(privateSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to remove the membership of a manager from a public site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify admin is able to remove the membership of a manager from a public site and response is 204")
|
||||
public void adminIsAbleToRemoveManagerSiteMembershipOfPublicSite() throws Exception
|
||||
{
|
||||
UserModel secondManager = dataUser.createRandomTestUser();
|
||||
@@ -187,9 +195,9 @@ public class DeleteSiteMemberCoreTests extends RestTest
|
||||
restClient.withCoreAPI().usingUser(managerModel).deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to remove the membership of a manager from a moderated site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify admin is able to remove the membership of a manager from a moderated site and response is 204")
|
||||
public void adminIsAbleToRemoveManagerSiteMembershipOfModeratedSite() throws Exception
|
||||
{
|
||||
UserModel secondManager = dataUser.createRandomTestUser();
|
||||
@@ -199,9 +207,9 @@ public class DeleteSiteMemberCoreTests extends RestTest
|
||||
restClient.withCoreAPI().usingUser(managerModel).deleteSiteMember(moderatedSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to remove the membership of a manager from a private site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify admin is able to remove the membership of a manager from a private site and response is 204")
|
||||
public void adminIsAbleToRemoveManagerSiteMembershipOfPrivateSite() throws Exception
|
||||
{
|
||||
UserModel secondManager = dataUser.createRandomTestUser();
|
||||
@@ -211,9 +219,9 @@ public class DeleteSiteMemberCoreTests extends RestTest
|
||||
restClient.withCoreAPI().usingUser(managerModel).deleteSiteMember(privateSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator is not able to remove the membership of a manager from a public site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify collaborator is not able to remove the membership of a manager from a public site and response is 204")
|
||||
public void userIsNotAbleToRemoveManagerSiteMembershipOfPublicSite() throws Exception
|
||||
{
|
||||
UserModel secondManager = dataUser.createRandomTestUser();
|
||||
@@ -222,11 +230,12 @@ public class DeleteSiteMemberCoreTests extends RestTest
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(userModel);
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(managerModel);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerModel).deleteSiteMember(publicSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, publicSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator is not able to remove the membership of a manager from a moderated site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify collaborator is not able to remove the membership of a manager from a moderated site and response is 204")
|
||||
public void userIsNotAbleToRemoveManagerSiteMembershipOfModeratedSite() throws Exception
|
||||
{
|
||||
UserModel secondManager = dataUser.createRandomTestUser();
|
||||
@@ -235,11 +244,12 @@ public class DeleteSiteMemberCoreTests extends RestTest
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(userModel);
|
||||
restClient.withCoreAPI().usingSite(moderatedSiteModel).addPerson(managerModel);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerModel).deleteSiteMember(moderatedSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, moderatedSiteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator is not able to remove the membership of a manager from a private site and response is 204")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify collaborator is not able to remove the membership of a manager from a private site and response is 204")
|
||||
public void userIsNotAbleToRemoveManagerSiteMembershipOfPrivateSite() throws Exception
|
||||
{
|
||||
UserModel secondManager = dataUser.createRandomTestUser();
|
||||
@@ -248,6 +258,7 @@ public class DeleteSiteMemberCoreTests extends RestTest
|
||||
restClient.withCoreAPI().usingSite(privateSiteModel).addPerson(userModel);
|
||||
restClient.withCoreAPI().usingSite(privateSiteModel).addPerson(managerModel);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerModel).deleteSiteMember(privateSiteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, privateSiteModel.getId()));
|
||||
}
|
||||
}
|
||||
@@ -17,103 +17,91 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class DeleteSiteMemberSanityTests extends RestTest
|
||||
{
|
||||
{
|
||||
private SiteModel siteModel;
|
||||
private UserModel adminUser;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
|
||||
UserRole.SiteManager,
|
||||
UserRole.SiteCollaborator,
|
||||
UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete another member of the site")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site manager is able to delete another member of the site")
|
||||
public void siteManagerCanDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser("testUser");
|
||||
newUser.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user is able to delete another member of the site")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to delete another member of the site")
|
||||
public void adminIsAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser("testUser");
|
||||
newUser.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site collaborator does not have permission to delete another member of the site")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site collaborator does not have permission to delete another member of the site")
|
||||
public void siteCollaboratorIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser("testUser");
|
||||
newUser.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
|
||||
restClient.withCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, siteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site contributor does not have permission to delete another member of the site")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site contributor does not have permission to delete another member of the site")
|
||||
public void siteContributorIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser("testUser");
|
||||
newUser.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
|
||||
restClient.withCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, siteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site consumer does not have permission to delete another member of the site")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer does not have permission to delete another member of the site")
|
||||
public void siteConsumerIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
UserModel newUser = dataUser.createRandomTestUser("testUser");
|
||||
newUser.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(siteModel).addPerson(newUser);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
|
||||
restClient.withCoreAPI().usingUser(newUser).deleteSiteMember(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError().containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, siteModel.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NOT_SUFFICIENT_PERMISSIONS, siteModel.getId()));
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify unauthenticated user is not able to delete another member of the site")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to delete another member of the site")
|
||||
public void unauthenticatedUserIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.alfresco.utility.exception.DataPreparationException;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
@@ -25,7 +24,8 @@ public class DeleteSiteMembershipRequestCoreTests extends RestTest
|
||||
UserModel siteMember;
|
||||
UserModel secondSiteMember;
|
||||
SiteModel secondModeratedSite;
|
||||
@Autowired WorkflowService workflow;
|
||||
@Autowired
|
||||
WorkflowService workflow;
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
|
||||
+64
-104
@@ -19,156 +19,116 @@ import org.testng.annotations.Test;
|
||||
/**
|
||||
* @author iulia.cojocea
|
||||
*/
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
|
||||
public class DeleteSiteMembershipRequestSanityTests extends RestTest
|
||||
{
|
||||
{
|
||||
UserModel userModel;
|
||||
UserModel siteMember;
|
||||
SiteModel siteModel;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception{
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
String siteId = RandomData.getRandomName("site");
|
||||
siteModel = dataSite.usingUser(userModel).createSite(new SiteModel(Visibility.MODERATED, siteId, siteId, siteId, siteId));
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
|
||||
UserRole.SiteManager,
|
||||
UserRole.SiteCollaborator,
|
||||
UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify one user is able to delete his one site memebership request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify one user is able to delete his one site memebership request")
|
||||
public void userCanDeleteHisOwnSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
siteMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(siteMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(siteMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI()
|
||||
.usingUser(siteMember).deleteSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingUser(siteMember)
|
||||
.deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16916")
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16916")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site manager is able to delete site membership request")
|
||||
public void siteManagerCanDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
siteMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(siteMember)
|
||||
.withCoreAPI()
|
||||
.usingUser(siteMember).addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(siteMember).withCoreAPI().usingUser(siteMember).addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingAuthUser()
|
||||
.deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16916")
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user is able to delete site memebership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16916")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to delete site memebership request")
|
||||
public void adminUserCanDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
siteMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(siteMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(siteMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(dataUser.getAdminUser())
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16916")
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user is not able to delete site memebership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16916")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user is not able to delete site memebership request")
|
||||
public void collaboratorCannotDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
siteMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(siteMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(siteMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingAuthUser()
|
||||
.deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16916")
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user is not able to delete site memebership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16916")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user is not able to delete site memebership request")
|
||||
public void contributorCannotDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
siteMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(siteMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.authenticateUser(siteMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingAuthUser()
|
||||
.deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16916")
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user is not able to delete site memebership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16916")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user is not able to delete site memebership request")
|
||||
public void consumerCannotDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
siteMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(siteMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.authenticateUser(siteMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingAuthUser()
|
||||
.deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-16916")
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify random user is not able to delete site memebership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16916")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify random user is not able to delete site memebership request")
|
||||
public void randomUserCanDeleteSiteMembershipRequest() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser())
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser()).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser())
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser()).withCoreAPI().usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Failed authentication get site member call returns status code 401")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Failed authentication get site member call returns status code 401")
|
||||
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteMmebershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser())
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser()).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingAuthUser().deleteSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ import org.testng.annotations.Test;
|
||||
/**
|
||||
* Created by Claudia Agache on 11/22/2016.
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
|
||||
public class GetFavoriteSiteCoreTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel site1;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
@@ -29,37 +29,32 @@ public class GetFavoriteSiteCoreTests extends RestTest
|
||||
dataSite.usingUser(userModel).usingSite(site1).addSiteToFavorites();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when personId does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify invalid request returns status 404 when personId does not exist")
|
||||
public void getFavoriteSiteWithNonExistentPersonId() throws Exception
|
||||
{
|
||||
UserModel someUser = new UserModel("someUser", DataUser.PASSWORD);
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(someUser).getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "someUser"));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "someUser"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when siteId does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify invalid request returns status 404 when siteId does not exist")
|
||||
public void getFavoriteSiteWithNonExistentSiteId() throws Exception
|
||||
{
|
||||
SiteModel nonExistentSite = new SiteModel("nonExistentSite");
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getFavoriteSite(nonExistentSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), nonExistentSite.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), nonExistentSite.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User fails to get specific favorite site of admin with Rest API and response is 403")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify User fails to get specific favorite site of admin with Rest API and response is 403")
|
||||
public void userFailsToGetFavoriteSiteOfAdmin() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(dataUser.getAdminUser()).getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,10 @@ import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests for Get Favorite Sites (/people/{personId}/preferences) RestAPI call
|
||||
*
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
|
||||
public class GetFavoriteSiteSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -27,17 +26,16 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
UserModel searchedUser;
|
||||
private RestSiteModel restSiteModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel1 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
siteModel2 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel1 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
siteModel2 = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
public void managerUserGetsFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -49,10 +47,9 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(siteModel1.getId()).and().field("title").isNotNull();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
public void collaboratorUserGetsFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -64,10 +61,9 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(siteModel1.getId()).and().field("title").isNotNull();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
public void contributorUserGetsFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -79,10 +75,9 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(siteModel1.getId()).and().field("title").isNotNull();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets its specific favorite site with Rest API and response is successful (200)")
|
||||
public void consumerUserGetsFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -94,10 +89,9 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(siteModel1.getId()).and().field("title").isNotNull();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user gets specific favorite site of any user with Rest API and response is successful (200)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets specific favorite site of any user with Rest API and response is successful (200)")
|
||||
public void adminUserGetsAnyFavoriteSiteWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUset = dataUser.getAdminUser();
|
||||
@@ -109,10 +103,9 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModel.assertThat().field("id").is(siteModel1.getId()).and().field("title").isNotNull();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user fails to get specific favorite site of another user with Rest API and response is successful (403)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user fails to get specific favorite site of another user with Rest API and response is successful (403)")
|
||||
public void managerUserFailsToGetFavoriteSiteOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -123,11 +116,10 @@ public class GetFavoriteSiteSanityTests extends RestTest
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(userModel).getFavoriteSite(siteModel1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user is NOT Authorized gets its specific favorite site with Rest API when authentication fails (401)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized gets its specific favorite site with Rest API when authentication fails (401)")
|
||||
public void managerUserNotAuthorizedFailsToGetFavoriteSite() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class GetFavoriteSitesSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -20,45 +19,42 @@ public class GetFavoriteSitesSanityTests extends RestTest
|
||||
UserModel searchedUser;
|
||||
private RestSiteModelsCollection restSiteModelsCollection;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user fails to get an user favorite sites with Rest API (403)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user fails to get an user favorite sites with Rest API (403)")
|
||||
public void managerUserFailsToGetAnUserFavoriteSites() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
UserModel anotherUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
UserModel anotherUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataSite.usingUser(anotherUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(anotherUser).getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user fails to get an user favorite sites with Rest API (403)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user fails to get an user favorite sites with Rest API (403)")
|
||||
public void collaboratorUserFailsToGetAnUserFavoriteSites() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(collaboratorUser, siteModel, UserRole.SiteCollaborator);
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
|
||||
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
|
||||
dataSite.usingUser(contributorUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restClient.authenticateUser(collaboratorUser).withCoreAPI().usingUser(contributorUser).getFavoriteSites();
|
||||
restClient.authenticateUser(collaboratorUser).withCoreAPI().usingUser(contributorUser).getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user fails to get an user favorite sites with Rest API (403)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user fails to get an user favorite sites with Rest API (403)")
|
||||
public void contributorUserFailsToGetAnUserFavoriteSites() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -70,10 +66,9 @@ public class GetFavoriteSitesSanityTests extends RestTest
|
||||
restClient.authenticateUser(contributorUser).withCoreAPI().usingUser(contributorUser2).getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user fails to get an user favorite sites with Rest API (403)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user fails to get an user favorite sites with Rest API (403)")
|
||||
public void consumerUserFailsToGetAnUserFavoriteSites() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -85,10 +80,9 @@ public class GetFavoriteSitesSanityTests extends RestTest
|
||||
restClient.authenticateUser(consumerUser).withCoreAPI().usingUser(collaboratorUser).getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user gets its favorite sites with Rest API and response is successful (200)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets its favorite sites with Rest API and response is successful (200)")
|
||||
public void adminUserGetsFavoriteSitesWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
@@ -97,31 +91,27 @@ public class GetFavoriteSitesSanityTests extends RestTest
|
||||
|
||||
restSiteModelsCollection = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(anotherUser).getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModelsCollection.assertThat().entriesListIsNotEmpty().and().paginationExist()
|
||||
.and().entriesListContains("id", siteModel.getId());
|
||||
restSiteModelsCollection.assertThat().entriesListIsNotEmpty().and().paginationExist().and().entriesListContains("id", siteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify any user gets its own user favorite sites with Rest API and response is successful (200)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify any user gets its own user favorite sites with Rest API and response is successful (200)")
|
||||
public void anyUserGetsItsUserFavoriteSites() throws Exception
|
||||
{
|
||||
UserModel anyUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
UserModel anyUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataSite.usingUser(anyUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restSiteModelsCollection = restClient.authenticateUser(anyUser).withCoreAPI().usingAuthUser().getFavoriteSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("id", siteModel.getId())
|
||||
.and().paginationExist();
|
||||
restSiteModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("id", siteModel.getId()).and().paginationExist();
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify any user is NOT Authorized to get its favorite sites with Rest API when authentication fails (401)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify any user is NOT Authorized to get its favorite sites with Rest API when authentication fails (401)")
|
||||
public void anyUserNotAuthenticatedIsNotAuthorizedToGetFavoriteSites() throws Exception
|
||||
{
|
||||
UserModel anyUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
UserModel anyUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataSite.usingUser(anyUser).usingSite(siteModel).addSiteToFavorites();
|
||||
anyUser.setPassword("newpassword");
|
||||
|
||||
|
||||
@@ -17,11 +17,9 @@ import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
* Tests for getActivities (/people/{personId}/activities) RestAPI call
|
||||
*
|
||||
* Tests for getActivities (/people/{personId}/activities) RestAPI call
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
|
||||
public class GetPeopleActivitiesSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel, unauthenticatedUser;
|
||||
@@ -35,14 +33,14 @@ public class GetPeopleActivitiesSanityTests extends RestTest
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
unauthenticatedUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
unauthenticatedUser.setPassword("newpassword");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user gets its activities with Rest API and response is successful")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify manager user gets its activities with Rest API and response is successful")
|
||||
public void managerUserShouldGetPeopleActivitiesList() throws Exception
|
||||
{
|
||||
UserModel managerUser = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
|
||||
@@ -50,13 +48,11 @@ public class GetPeopleActivitiesSanityTests extends RestTest
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId())
|
||||
.and().paginationExist();
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user gets its activities with Rest API and response is successful")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets its activities with Rest API and response is successful")
|
||||
public void collaboratorUserShouldGetPeopleActivitiesList() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
@@ -64,13 +60,11 @@ public class GetPeopleActivitiesSanityTests extends RestTest
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser().getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId())
|
||||
.and().paginationExist();
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user gets its activities with Rest API and response is successful")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets its activities with Rest API and response is successful")
|
||||
public void contributorUserShouldGetPeopleActivitiesList() throws Exception
|
||||
{
|
||||
UserModel contributorUser = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
|
||||
@@ -78,37 +72,31 @@ public class GetPeopleActivitiesSanityTests extends RestTest
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId())
|
||||
.and().paginationExist();
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user gets its activities with Rest API and response is successful")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets its activities with Rest API and response is successful")
|
||||
public void consumerUserShouldGetPeopleActivitiesList() throws Exception
|
||||
{
|
||||
UserModel consumerUser = usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer);
|
||||
|
||||
|
||||
restActivityModelsCollection = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser().getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId())
|
||||
.and().paginationExist();
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user gets another user activities with Rest API and response is successful")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify admin user gets another user activities with Rest API and response is successful")
|
||||
public void adminUserShouldGetPeopleActivitiesList() throws Exception
|
||||
{
|
||||
restActivityModelsCollection = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(userModel).getPersonActivities();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId())
|
||||
.and().paginationExist();
|
||||
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify unauthenticated user is NOT Authorized to gets another user activities with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is NOT Authorized to gets another user activities with Rest API")
|
||||
public void unauthenticatedUserShouldNotGetPeopleActivitiesList() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(unauthenticatedUser).withCoreAPI().usingUser(userModel).getPersonActivities();
|
||||
|
||||
@@ -19,22 +19,22 @@ import org.testng.annotations.Test;
|
||||
* Tests for Get a Peference (/people/{personId}/preferences/{preferenceName}) RestAPI call
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
|
||||
public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel siteModel;
|
||||
private RestPreferenceModel restPreferenceModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
|
||||
@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 gets a specific preference with Rest API and response is successful (200)")
|
||||
public void managerUserGetsAPreferenceWithSuccess() throws Exception
|
||||
{
|
||||
@@ -42,13 +42,13 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(managerUser)
|
||||
.withCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModel = restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is( PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
}
|
||||
|
||||
|
||||
@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 collaborator user gets a specific preference with Rest API and response is successful (200)")
|
||||
public void collaboratorUserGetsAPreferenceWithSuccess() throws Exception
|
||||
{
|
||||
@@ -56,13 +56,13 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataUser.usingUser(userModel).addUserToSite(collaboratorUser, siteModel, UserRole.SiteCollaborator);
|
||||
dataSite.usingUser(collaboratorUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(collaboratorUser)
|
||||
.withCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModel = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
}
|
||||
|
||||
|
||||
@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 contributor user gets a specific preference with Rest API and response is successful (200)")
|
||||
public void contributorUserGetsAPreferenceWithSuccess() throws Exception
|
||||
{
|
||||
@@ -70,13 +70,13 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
|
||||
dataSite.usingUser(contributorUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(contributorUser)
|
||||
.withCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModel = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
}
|
||||
|
||||
|
||||
@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 consumer user gets a specific preference with Rest API and response is successful (200)")
|
||||
public void consumerUserGetsAPreferenceWithSuccess() throws Exception
|
||||
{
|
||||
@@ -84,26 +84,26 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel, UserRole.SiteConsumer);
|
||||
dataSite.usingUser(consumerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(consumerUser)
|
||||
.withCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModel = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
}
|
||||
|
||||
|
||||
@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 admin user gets a specific preference with Rest API and response is successful (200)")
|
||||
public void adminUserGetsAPreferenceWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
dataSite.usingUser(adminUser).usingSite(siteModel).addSiteToFavorites();
|
||||
|
||||
restPreferenceModel = restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModel = restClient.authenticateUser(adminUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId())
|
||||
.and().field("value").is("true");
|
||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId()).and().field("value").is("true");
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to get a specific preference with Rest API when authentication fails (401)")
|
||||
public void managerUserNotAuthorizedFailsToGetsAPreference() throws Exception
|
||||
@@ -113,8 +113,8 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
||||
dataSite.usingUser(managerUser).usingSite(siteModel).addSiteToFavorites();
|
||||
managerUser.setPassword("newpassword");
|
||||
|
||||
restClient.authenticateUser(managerUser)
|
||||
.withCoreAPI().usingAuthUser().getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,12 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public class GetPeoplePreferencesCoreTests extends RestTest
|
||||
public class GetPeoplePreferencesCoreTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
@@ -25,8 +24,8 @@ public class GetPeoplePreferencesCoreTests extends RestTest
|
||||
dataSite.usingUser(userModel).usingSite(siteModel).addSiteToFavorites();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user is Forbidden to get a specific preference for another user with Rest API and response is 403")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify user is Forbidden to get a specific preference for another user with Rest API and response is 403")
|
||||
public void userDoesNotHaveAccessToFavoriteSitesOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondUser = dataUser.createRandomTestUser();
|
||||
@@ -36,8 +35,8 @@ public class GetPeoplePreferencesCoreTests extends RestTest
|
||||
restClient.assertLastError().containsSummary("Permission was denied");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager fails to get a specific preference for an invalid user with Rest API and response is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify manager fails to get a specific preference for an invalid user with Rest API and response is 404")
|
||||
public void statusNotFoundIsReturnedForAPersonIDThatDoesNotExist() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(new UserModel("invalidPersonID", "password"))
|
||||
@@ -46,19 +45,19 @@ public class GetPeoplePreferencesCoreTests extends RestTest
|
||||
restClient.assertLastError().containsSummary("The entity with id: invalidPersonID was not found");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager fails to get a specific preference for an invalid preference with Rest API and response is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify manager fails to get a specific preference for an invalid preference with Rest API and response is 404")
|
||||
public void statusNotFoundIsReturnedForAPreferenceNameThatDoesNotExist() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation("invalidPreferenceName");
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getPersonPreferenceInformation("invalidPreferenceName");
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(String.format("The relationship resource was not found for the" +
|
||||
" entity with id: %s and a relationship id of invalidPreferenceName", userModel.getUsername()));
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of invalidPreferenceName",
|
||||
userModel.getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager fails to get a specific preference for an removed preference with Rest API and response is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION, description = "Verify manager fails to get a specific preference for an removed preference with Rest API and response is 404")
|
||||
public void statusNotFoundIsReturnedForAPreferenceNameThatHasBeenRemoved() throws Exception
|
||||
{
|
||||
SiteModel preferenceSite = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
@@ -67,8 +66,8 @@ public class GetPeoplePreferencesCoreTests extends RestTest
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + preferenceSite.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(String.format("The relationship resource was not found for the" +
|
||||
" entity with id: %s and a relationship id of %s", userModel.getUsername(),
|
||||
PreferenceName.SITES_FAVORITES_PREFIX + preferenceSite.getId()));
|
||||
restClient.assertLastError().containsSummary(
|
||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", userModel.getUsername(),
|
||||
PreferenceName.SITES_FAVORITES_PREFIX + preferenceSite.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,25 +19,23 @@ import org.testng.annotations.Test;
|
||||
* Tests for Get Peferences (/people/{personId}/preferences) RestAPI call
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
|
||||
public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel siteModel;
|
||||
private RestPreferenceModelsCollection restPreferenceModelsCollection;
|
||||
private RestPreferenceModelsCollection restPreferenceModelsCollection;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user gets its preferences with Rest API and response is successful (200)")
|
||||
|
||||
@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 gets its preferences with Rest API and response is successful (200)")
|
||||
public void managerUserGetsPeoplePreferencesWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -46,13 +44,12 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist()
|
||||
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user gets its preferences with Rest API and response is successful (200)")
|
||||
|
||||
@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 collaborator user gets its preferences with Rest API and response is successful (200)")
|
||||
public void collaboratorUserGetsPeoplePreferencesWithSuccess() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -61,13 +58,12 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist()
|
||||
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user gets its preferences with Rest API and response is successful (200)")
|
||||
|
||||
@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 contributor user gets its preferences with Rest API and response is successful (200)")
|
||||
public void contributorUserGetsPeoplePreferencesWithSuccess() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -76,13 +72,12 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist()
|
||||
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user gets its preferences with Rest API and response is successful (200)")
|
||||
|
||||
@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 consumer user gets its preferences with Rest API and response is successful (200)")
|
||||
public void consumerUserGetsPeoplePreferencesWithSuccess() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -91,13 +86,12 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist()
|
||||
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user gets another user preferences with Rest API and response is successful (200)")
|
||||
|
||||
@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 admin user gets another user preferences with Rest API and response is successful (200)")
|
||||
public void adminUserGetsPeoplePreferencesWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
@@ -107,14 +101,13 @@ public class GetPeoplePreferencesSanityTests extends RestTest
|
||||
|
||||
restPreferenceModelsCollection = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(managerUser).getPersonPreferences();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist()
|
||||
.and().entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
restPreferenceModelsCollection.assertThat().entriesListIsNotEmpty().assertThat().paginationExist().and()
|
||||
.entriesListContains("id", PreferenceName.SITES_FAVORITES_PREFIX + siteModel.getId());
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user is NOT Authorized to gets its preferences with Rest API when authentication fails(401)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to gets its preferences with Rest API when authentication fails(401)")
|
||||
public void managerUserGetsPeoplePreferencesIsNotAuthorized() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class GetPeopleSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -24,7 +23,7 @@ public class GetPeopleSanityTests extends RestTest
|
||||
private RestPersonModel personModel;
|
||||
private String domain = "@tas-automation.org";
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
@@ -33,112 +32,80 @@ public class GetPeopleSanityTests extends RestTest
|
||||
searchedUser = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user gets a person with Rest API and response is successful")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets a person with Rest API and response is successful")
|
||||
public void managerUserChecksIfPersonIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
|
||||
personModel = restClient.authenticateUser(managerUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(searchedUser)
|
||||
.getPerson();
|
||||
personModel = restClient.authenticateUser(managerUser).withCoreAPI().usingUser(searchedUser).getPerson();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername())
|
||||
.assertThat().field("firstName").is(searchedUser.getUsername()+" FirstName")
|
||||
.and().field("email").is(searchedUser.getUsername()+ domain)
|
||||
.and().field("emailNotificationsEnabled").is("true");
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and()
|
||||
.field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user gets a person with Rest API and response is successful")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets a person with Rest API and response is successful")
|
||||
public void collaboratorUserChecksIfPersonIsPresent() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(collaboratorUser, siteModel, UserRole.SiteCollaborator);
|
||||
|
||||
personModel = restClient.authenticateUser(collaboratorUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(searchedUser)
|
||||
.getPerson();
|
||||
personModel = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingUser(searchedUser).getPerson();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername())
|
||||
.assertThat().field("firstName").is(searchedUser.getUsername()+" FirstName")
|
||||
.and().field("email").is(searchedUser.getUsername()+ domain)
|
||||
.and().field("emailNotificationsEnabled").is("true");
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and()
|
||||
.field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true");
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user gets a person with Rest API and response is successful")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.COMMENTS, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets a person with Rest API and response is successful")
|
||||
public void contributorUserChecksIfPersonIsPresent() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
|
||||
|
||||
personModel = restClient.authenticateUser(contributorUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(searchedUser)
|
||||
.getPerson();
|
||||
personModel = restClient.authenticateUser(contributorUser).withCoreAPI().usingUser(searchedUser).getPerson();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername())
|
||||
.assertThat().field("firstName").is(searchedUser.getUsername()+" FirstName")
|
||||
.and().field("email").is(searchedUser.getUsername()+ domain)
|
||||
.and().field("emailNotificationsEnabled").is("true");;
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and()
|
||||
.field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true");
|
||||
;
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user gets a person with Rest API and response is successful")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets a person with Rest API and response is successful")
|
||||
public void consumerUserChecksIfPersonIsPresent() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel, UserRole.SiteConsumer);
|
||||
|
||||
personModel = restClient.authenticateUser(consumerUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(searchedUser)
|
||||
.getPerson();
|
||||
personModel = restClient.authenticateUser(consumerUser).withCoreAPI().usingUser(searchedUser).getPerson();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername())
|
||||
.assertThat().field("firstName").is(searchedUser.getUsername()+" FirstName")
|
||||
.and().field("email").is(searchedUser.getUsername()+ domain)
|
||||
.and().field("emailNotificationsEnabled").is("true");;
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and()
|
||||
.field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true");
|
||||
;
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user gets a person with Rest API and response is successful")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets a person with Rest API and response is successful")
|
||||
public void adminUserChecksIfPersonIsPresent() throws Exception
|
||||
{
|
||||
personModel = restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(searchedUser)
|
||||
.getPerson();
|
||||
personModel = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(searchedUser).getPerson();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername())
|
||||
.assertThat().field("firstName").is(searchedUser.getUsername()+" FirstName")
|
||||
.and().field("email").is(searchedUser.getUsername()+ domain)
|
||||
.and().field("emailNotificationsEnabled").is("true");;
|
||||
personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and()
|
||||
.field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true");
|
||||
;
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user gets a non existing person with Rest API and person is not found")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets a non existing person with Rest API and person is not found")
|
||||
public void managerUserChecksIfNonExistingPersonIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
UserModel searchedNonUser = new UserModel("nonexistinguser", DataUser.PASSWORD);
|
||||
|
||||
restClient.authenticateUser(managerUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(searchedNonUser)
|
||||
.getPerson();
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(searchedNonUser).getPerson();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import org.testng.annotations.Test;
|
||||
/**
|
||||
* Created by Claudia Agache on 11/28/2016.
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
|
||||
public class GetSiteMembershipCoreTests extends RestTest
|
||||
{
|
||||
UserModel regularUser, publicSiteManager, privateSiteManager, moderatedSiteManager, adminUser;
|
||||
@@ -26,7 +26,7 @@ public class GetSiteMembershipCoreTests extends RestTest
|
||||
private DataUser.ListUserWithRoles publicSiteUsers;
|
||||
private RestSiteEntry restSiteEntry;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
@@ -37,123 +37,98 @@ public class GetSiteMembershipCoreTests extends RestTest
|
||||
privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
|
||||
publicSiteUsers = dataUser.addUsersWithRolesToSite(publicSite,
|
||||
UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
publicSiteUsers = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
publicSiteManager = publicSiteUsers.getOneUserWithRole(UserRole.SiteManager);
|
||||
dataUser.usingAdmin().addUserToSite(privateSiteManager, privateSite, UserRole.SiteManager);
|
||||
dataUser.usingAdmin().addUserToSite(moderatedSiteManager, moderatedSite, UserRole.SiteManager);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request using -me- string in place of personId returns site membership information for currently authenticated user.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify request using -me- string in place of personId returns site membership information for currently authenticated user.")
|
||||
public void getSiteMembershipUsingMe() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restSiteEntry = restClient.withCoreAPI().usingMe().getSiteMembership(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteCollaborator)
|
||||
.and().field("id").is(publicSite.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteCollaborator).and().field("id").is(publicSite.getId()).and().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@Bug(id="REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get site membership for a site returns status 404 when personId does not exist.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@Bug(id = "REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify get site membership for a site returns status 404 when personId does not exist.")
|
||||
public void getSiteMembershipUsingNonExistentPersonId() throws Exception
|
||||
{
|
||||
UserModel someUser = new UserModel("someUser", DataUser.PASSWORD);
|
||||
|
||||
restClient.authenticateUser(regularUser).withCoreAPI().usingUser(someUser).getSiteMembership(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "someUser"));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "someUser"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get site membership for a site returns status 404 when siteId does not exist.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify get site membership for a site returns status 404 when siteId does not exist.")
|
||||
public void getSiteMembershipUsingNonExistentSiteId() throws Exception
|
||||
{
|
||||
SiteModel someSite = new SiteModel("someSite");
|
||||
|
||||
restClient.authenticateUser(regularUser).withCoreAPI().usingAuthUser().getSiteMembership(someSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, regularUser.getUsername(), "someSite"));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, regularUser.getUsername(), "someSite"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get site membership for a site returns status 404 when personId is not a site member.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify get site membership for a site returns status 404 when personId is not a site member.")
|
||||
public void getSiteMembershipForPersonThatIsNotSiteMember() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteManager).withCoreAPI()
|
||||
.usingUser(regularUser).getSiteMembership(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, regularUser.getUsername(), publicSite.getTitle()));
|
||||
restClient.authenticateUser(publicSiteManager).withCoreAPI().usingUser(regularUser).getSiteMembership(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, regularUser.getUsername(), publicSite.getTitle()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user is not able to retrieve site membership information of a private site member.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify regular user is not able to retrieve site membership information of a private site member.")
|
||||
public void regularUserIsNotAbleToRetrieveSiteMembershipForPrivateSiteManager() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withCoreAPI()
|
||||
.usingUser(privateSiteManager).getSiteMembership(privateSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, privateSiteManager.getUsername(), privateSite.getTitle()));
|
||||
restClient.authenticateUser(regularUser).withCoreAPI().usingUser(privateSiteManager).getSiteMembership(privateSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, privateSiteManager.getUsername(), privateSite.getTitle()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user is able to retrieve site membership information of a moderated site member.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify regular user is able to retrieve site membership information of a moderated site member.")
|
||||
public void regularUserGetsSiteMembershipForModeratedSiteMember() throws Exception
|
||||
{
|
||||
restSiteEntry = restClient.authenticateUser(regularUser).withCoreAPI()
|
||||
.usingUser(moderatedSiteManager).getSiteMembership(moderatedSite);
|
||||
restSiteEntry = restClient.authenticateUser(regularUser).withCoreAPI().usingUser(moderatedSiteManager).getSiteMembership(moderatedSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteManager)
|
||||
.and().field("id").is(moderatedSite.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteManager).and().field("id").is(moderatedSite.getId()).and().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify regular user is able to retrieve site membership information of a public site member.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify regular user is able to retrieve site membership information of a public site member.")
|
||||
public void regularUserGetsSiteMembershipForPublicSiteMember() throws Exception
|
||||
{
|
||||
restSiteEntry = restClient.authenticateUser(regularUser).withCoreAPI()
|
||||
.usingUser(publicSiteManager).getSiteMembership(publicSite);
|
||||
restSiteEntry = restClient.authenticateUser(regularUser).withCoreAPI().usingUser(publicSiteManager).getSiteMembership(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteManager)
|
||||
.and().field("id").is(publicSite.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteManager).and().field("id").is(publicSite.getId()).and().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if Admin user is able to retrieve site membership information of him.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify if Admin user is able to retrieve site membership information of him.")
|
||||
public void adminGetsSiteMembershipForHim() throws Exception
|
||||
{
|
||||
restSiteEntry = restClient.authenticateUser(adminUser).withCoreAPI()
|
||||
.usingUser(adminUser).getSiteMembership(privateSite);
|
||||
restSiteEntry = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(adminUser).getSiteMembership(privateSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteManager)
|
||||
.and().field("id").is(privateSite.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restSiteEntry.assertThat().field("role").is(UserRole.SiteManager).and().field("id").is(privateSite.getId()).and().field("site").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if Admin user is able to retrieve site membership information of him.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify if Admin user is able to retrieve site membership information of him.")
|
||||
public void getSiteMembershipAfterRemovingASiteMember() throws Exception
|
||||
{
|
||||
UserModel publicSiteConsumer = publicSiteUsers.getOneUserWithRole(UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(publicSiteManager).withCoreAPI()
|
||||
.usingSite(publicSite).deleteSiteMember(publicSiteConsumer);
|
||||
restClient.authenticateUser(publicSiteManager).withCoreAPI()
|
||||
.usingUser(publicSiteConsumer).getSiteMembership(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, publicSiteConsumer.getUsername(), publicSite.getTitle()));
|
||||
restClient.authenticateUser(publicSiteManager).withCoreAPI().usingSite(publicSite).deleteSiteMember(publicSiteConsumer);
|
||||
restClient.authenticateUser(publicSiteManager).withCoreAPI().usingUser(publicSiteConsumer).getSiteMembership(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, publicSiteConsumer.getUsername(), publicSite.getTitle()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public class GetSiteMembershipInformationCoreTests extends RestTest
|
||||
{
|
||||
private SiteModel publicSiteModel;
|
||||
@@ -22,7 +21,7 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
|
||||
private UserModel userModel;
|
||||
UserModel leaveSiteUserModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
@@ -33,159 +32,108 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
|
||||
dataUser.addUserToSite(leaveSiteUserModel, publicSiteModel, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to retrieve site membership information with -me- as personId")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager is able to retrieve site membership information with -me- as personId")
|
||||
public void siteManagerCanRetrieveSiteMembershipInformationWithMeAsPersonId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingMe()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationExist()
|
||||
.and().paginationField("count").isNot("0");
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingMe().getSitesMembershipInformation().assertThat().entriesListIsNotEmpty().and()
|
||||
.paginationExist().and().paginationField("count").isNot("0");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to retrieve site membership information for a personId that does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager is not able to retrieve site membership information for a personId that does not exist")
|
||||
public void siteManagerCantRetrieveSiteMembershipInformationForAPersonIdThatDoesNotExist() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingUser(new UserModel("invalidPersonId", "password"))
|
||||
.getSitesMembershipInformation()
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(new UserModel("invalidPersonId", "password")).getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidPersonId"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get site membership information request returns status code 400 when invalid maxItems parameter is used")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify if get site membership information request returns status code 400 when invalid maxItems parameter is used")
|
||||
public void getSiteMembershipInformationRequestReturns400ForInvalidMaxItemsParameter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withParams("maxItems=0")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.authenticateUser(userModel).withParams("maxItems=0").withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat()
|
||||
.entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
|
||||
restClient.withParams("maxItems=-1")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.withParams("maxItems=-1").withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
|
||||
restClient.withParams("maxItems=test")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.withParams("maxItems=test").withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "test"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get site membership information request returns status code 200 for valid maxItems parameter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify if get site membership information request returns status code 200 for valid maxItems parameter")
|
||||
public void getSiteMembershipInformationRequestReturns200ForValidMaxItemsParameter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withParams("maxItems=5")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.getPagination().assertThat().field("maxItems").is("5");
|
||||
restClient.authenticateUser(userModel).withParams("maxItems=5").withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat()
|
||||
.entriesListIsNotEmpty().getPagination().assertThat().field("maxItems").is("5");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get site membership information request returns status code 400 when invalid skipCount parameter is used")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify if get site membership information request returns status code 400 when invalid skipCount parameter is used")
|
||||
public void getSiteMembershipInformationRequestReturns400ForInvalidSkipCountParameter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withParams("skipCount=-1")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.authenticateUser(userModel).withParams("skipCount=-1").withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat()
|
||||
.entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT);
|
||||
|
||||
restClient.withParams("skipCount=test")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.withParams("skipCount=test").withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "test"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get site membership information request returns status code 200 for valid skipCount parameter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify if get site membership information request returns status code 200 for valid skipCount parameter")
|
||||
public void getSiteMembershipInformationRequestReturns200ForValidSkipCountParameter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withParams("skipCount=1")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.getPagination().assertThat().field("skipCount").is("1");
|
||||
restClient.authenticateUser(userModel).withParams("skipCount=1").withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat()
|
||||
.entriesListIsNotEmpty().getPagination().assertThat().field("skipCount").is("1");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to retrieve public sites")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager is able to retrieve public sites")
|
||||
public void siteManagerCheckThatPublicSitesAreRetrieved() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListContains("id", publicSiteModel.getId());
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat()
|
||||
.entriesListContains("id", publicSiteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to retrieve moderated sites")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager is able to retrieve moderated sites")
|
||||
public void siteManagerCheckThatModeratedSitesAreRetrieved() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListContains("id", moderatedSiteModel.getId());
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat()
|
||||
.entriesListContains("id", moderatedSiteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to retrieve private sites")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site manager is able to retrieve private sites")
|
||||
public void siteManagerCheckThatPrivateSitesAreRetrieved() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListContains("id", privateSiteModel.getId());
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat()
|
||||
.entriesListContains("id", privateSiteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site member is able to leave site")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify site member is able to leave site")
|
||||
public void siteMemberIsAbleToLeaveSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(leaveSiteUserModel).withCoreAPI().usingAuthUser().deleteSiteMember(publicSiteModel);
|
||||
restClient.authenticateUser(leaveSiteUserModel)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.authenticateUser(leaveSiteUserModel).withCoreAPI().usingAuthUser().getSitesMembershipInformation().assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
|
||||
*
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
|
||||
public class GetSiteMembershipRequestCoreTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -30,136 +30,100 @@ public class GetSiteMembershipRequestCoreTests extends RestTest
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createModeratedRandomSite();
|
||||
newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
@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)")
|
||||
@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)")
|
||||
public void unauthorizedContributorUserFailsToGetSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel contributor = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(contributor, siteModel, UserRole.SiteContributor);
|
||||
contributor.setPassword("newpassword");
|
||||
restClient.authenticateUser(contributor)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(contributor).withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@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)")
|
||||
|
||||
@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)")
|
||||
public void unauthorizedCollaboratorUserFailsToGetSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel collaborator = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(collaborator, siteModel, UserRole.SiteContributor);
|
||||
collaborator.setPassword("newpassword");
|
||||
restClient.authenticateUser(collaborator)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(collaborator).withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@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)")
|
||||
|
||||
@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)")
|
||||
public void unauthorizedConsumerUserFailsToGetSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel consumer = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(consumer, siteModel, UserRole.SiteContributor);
|
||||
consumer.setPassword("newpassword");
|
||||
restClient.authenticateUser(consumer)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(consumer).withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@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)")
|
||||
|
||||
@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)")
|
||||
public void usingMeGetSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingMe().getSiteMembershipRequest(siteModel)
|
||||
.assertThat().field("id").is(siteModel.getId());
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingMe().getSiteMembershipRequest(siteModel).assertThat().field("id").is(siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@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)")
|
||||
|
||||
@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)")
|
||||
public void siteManagerCantGetSiteMembershipRequestsInexistentUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingUser(UserModel.getRandomUserModel()).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingUser(UserModel.getRandomUserModel()).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@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)")
|
||||
|
||||
@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)")
|
||||
public void userCantGetSiteMembershipRequestsWithNoRequests() throws Exception
|
||||
{
|
||||
UserModel noRequestUser = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(noRequestUser)
|
||||
.withCoreAPI()
|
||||
.usingMe().getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, noRequestUser.getUsername(), siteModel.getId()));
|
||||
restClient.authenticateUser(noRequestUser).withCoreAPI().usingMe().getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, noRequestUser.getUsername(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@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)")
|
||||
|
||||
@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)")
|
||||
public void siteManagerCantGetPublicSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel publicUser = dataUser.createRandomTestUser();
|
||||
SiteModel publicSite = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
restClient.authenticateUser(publicUser)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(publicSite);
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingUser(publicUser).getSiteMembershipRequest(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, publicUser.getUsername(), publicSite.getId()));
|
||||
restClient.authenticateUser(publicUser).withCoreAPI().usingAuthUser().addSiteMembershipRequest(publicSite);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(publicUser).getSiteMembershipRequest(publicSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, publicUser.getUsername(), publicSite.getId()));
|
||||
}
|
||||
|
||||
@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)")
|
||||
|
||||
@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)")
|
||||
public void siteManagerCantGetPrivateSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel privateUser = dataUser.createRandomTestUser();
|
||||
SiteModel privateSite = dataSite.usingUser(userModel).createPrivateRandomSite();
|
||||
restClient.authenticateUser(privateUser)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(privateSite);
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingUser(privateUser).getSiteMembershipRequest(privateSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, privateUser.getUsername(), privateSite.getId()));
|
||||
restClient.authenticateUser(privateUser).withCoreAPI().usingAuthUser().addSiteMembershipRequest(privateSite);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(privateUser).getSiteMembershipRequest(privateSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, privateUser.getUsername(), privateSite.getId()));
|
||||
}
|
||||
|
||||
@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)")
|
||||
@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)")
|
||||
public void siteManagerCantGetSiteMembershipRequestsForInexistentSite() throws Exception
|
||||
{
|
||||
SiteModel inexistentSite = SiteModel.getRandomSiteModel();
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI()
|
||||
.usingMe().getSiteMembershipRequest(inexistentSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), inexistentSite.getId()));
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingMe().getSiteMembershipRequest(inexistentSite);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), inexistentSite.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class GetSiteMembershipRequestSanityTests extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
@@ -34,101 +33,88 @@ public class GetSiteMembershipRequestSanityTests extends RestTest
|
||||
|
||||
private UserModel adminUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site manager is able to retrieve site membership request")
|
||||
@Bug(id="MNT-16557")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site manager is able to retrieve site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteManagerIsAbleToRetrieveSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site collaborator is able to retrieve site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site collaborator is able to retrieve site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteCollaboratorIsAbleToRetrieveSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site contributor is able to retrieve site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site contributor is able to retrieve site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteContributorIsAbleToRetrieveSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site consumer is able to retrieve site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is able to retrieve site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void siteConsumerIsAbleToRetrieveSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify admin user is able to retrieve site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to retrieve site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void adminIsAbleToRetrieveSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve site membership request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve site membership request")
|
||||
@Bug(id = "MNT-16557")
|
||||
public void unauthenticatedUserIsNotAbleToRetrieveSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI().usingUser(newMember).addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingUser(newMember).getSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import org.alfresco.rest.model.RestTaskModel;
|
||||
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;
|
||||
@@ -41,7 +40,7 @@ public class GetSiteMembershipRequestsCoreTests extends RestTest
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify that for invalid maxItems parameter status code returned is 400.")
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify that for invalid maxItems parameter status code returned is 400.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public void checkInvalidMaxItemsStatusCode() throws Exception
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.testng.annotations.Test;
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
|
||||
public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
@@ -33,111 +33,88 @@ public class GetSiteMembershipRequestsSanityTests extends RestTest
|
||||
String siteId = RandomData.getRandomName("site");
|
||||
siteModel = dataSite.usingUser(userModel).createSite(new SiteModel(Visibility.MODERATED, siteId, siteId, siteId, siteId));
|
||||
newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user gets all site membership requests of a specific person with Rest API and response is successful (200)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user gets all site membership requests of a specific person with Rest API and response is successful (200)")
|
||||
public void managerUserGetsSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(managerUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify collaborator user fails to get all site membership requests of another user with Rest API (403)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user fails to get all site membership requests of another user with Rest API (403)")
|
||||
public void collaboratorUserFailsToGetSiteMembershipRequestsOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(collaboratorUser, siteModel, UserRole.SiteCollaborator);
|
||||
|
||||
restClient.authenticateUser(collaboratorUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
|
||||
restClient.authenticateUser(collaboratorUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify contributor user fails to get all site membership requests of another user with Rest API (403)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user fails to get all site membership requests of another user with Rest API (403)")
|
||||
public void contributorUserFailsToGetSiteMembershipRequestsOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(contributorUser, siteModel, UserRole.SiteContributor);
|
||||
|
||||
restClient.authenticateUser(contributorUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
|
||||
restClient.authenticateUser(contributorUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify consumer user fails to get all site membership requests of another user with Rest API (403)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user fails to get all site membership requests of another user with Rest API (403)")
|
||||
public void consumerUserFailsToGetSiteMembershipRequestsOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(consumerUser, siteModel, UserRole.SiteConsumer);
|
||||
|
||||
restClient.authenticateUser(consumerUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
|
||||
restClient.authenticateUser(consumerUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16557")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user gets all site membership requests of a specific person with Rest API and response is successful (200)")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user gets all site membership requests of a specific person with Rest API and response is successful (200)")
|
||||
public void adminUserGetsSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager user 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.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 managerUserNotAuthorizedFailsToGetSiteMembershipRequests() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager);
|
||||
managerUser.setPassword("newpassword");
|
||||
restClient.authenticateUser(managerUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(newMember).getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify a user gets all its own site membership requests with Rest API and response is successful (200)")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify a user gets all its own site membership requests with Rest API and response is successful (200)")
|
||||
public void oneUserGetsItsOwnSiteMembershipRequestsWithSuccess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingUser(newMember).getSiteMembershipRequests().assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,106 +16,75 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class GetSiteMembershipSanityTests extends RestTest
|
||||
{
|
||||
private SiteModel siteModel;
|
||||
private UserModel adminUser;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
|
||||
UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to retrieve site membership information of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site manager is able to retrieve site membership information of another user")
|
||||
public void siteManagerCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSiteMembership(siteModel)
|
||||
.assertThat().field("role").is(UserRole.SiteManager)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingUser(adminUser).getSiteMembership(siteModel)
|
||||
.assertThat().field("role").is(UserRole.SiteManager).and().field("id").is(siteModel.getId()).and().field("site").isNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site collaborator is able to retrieve site membership information of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site collaborator is able to retrieve site membership information of another user")
|
||||
public void siteCollaboratorCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSiteMembership(siteModel)
|
||||
.onSite()
|
||||
.assertThat().field("role").is(UserRole.SiteCollaborator)
|
||||
.and().field("id").is(siteModel.getId());
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingUser(adminUser)
|
||||
.getSiteMembership(siteModel).onSite().assertThat().field("role").is(UserRole.SiteCollaborator).and().field("id").is(siteModel.getId());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site contributor is able to retrieve site membership information of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site contributor is able to retrieve site membership information of another user")
|
||||
public void siteContributorCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSiteMembership(siteModel)
|
||||
.assertThat().field("role").is(UserRole.SiteManager)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingUser(adminUser)
|
||||
.getSiteMembership(siteModel).assertThat().field("role").is(UserRole.SiteManager).and().field("id").is(siteModel.getId()).and().field("site")
|
||||
.isNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is able to retrieve site membership information of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is able to retrieve site membership information of another user")
|
||||
public void siteConsumerCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSiteMembership(siteModel)
|
||||
.assertThat().field("role").is(UserRole.SiteManager)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingUser(adminUser).getSiteMembership(siteModel)
|
||||
.assertThat().field("role").is(UserRole.SiteManager).and().field("id").is(siteModel.getId()).and().field("site").isNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin user is able to retrieve site membership information of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to retrieve site membership information of another user")
|
||||
public void adminCanRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.getSiteMembership(siteModel)
|
||||
.assertThat().field("role").is(UserRole.SiteManager)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("site").isNotEmpty();
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).getSiteMembership(siteModel)
|
||||
.assertThat().field("role").is(UserRole.SiteManager).and().field("id").is(siteModel.getId()).and().field("site").isNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@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")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify unauthenticated user is not able to retrieve site membership information of another user")
|
||||
@Bug(id = "MNT-16904")
|
||||
public void unauthenticatedUserCannotRetrieveSiteMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"))
|
||||
.withCoreAPI()
|
||||
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.getSiteMembership(siteModel);
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).withCoreAPI()
|
||||
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).getSiteMembership(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
-64
@@ -16,107 +16,74 @@ import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class GetSitesMembershipInformationSanityTests extends RestTest
|
||||
{
|
||||
private SiteModel siteModel;
|
||||
private UserModel adminUser;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to retrieve sites membership information of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site manager is able to retrieve sites membership information of another user")
|
||||
public void siteManagerIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationExist()
|
||||
.and().paginationField("count").isNot("0");
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingUser(adminUser).getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty().and().paginationExist().and().paginationField("count").isNot("0");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site collaborator is able to retrieve sites membership information of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site collaborator is able to retrieve sites membership information of another user")
|
||||
public void siteCollaboratorIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationExist()
|
||||
.and().paginationField("count").isNot("0");
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingUser(adminUser)
|
||||
.getSitesMembershipInformation().assertThat().entriesListIsNotEmpty().and().paginationExist().and().paginationField("count").isNot("0");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site contributor is able to retrieve sites membership information of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site contributor is able to retrieve sites membership information of another user")
|
||||
public void siteContributorIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationExist()
|
||||
.and().paginationField("count").isNot("0");
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingUser(adminUser)
|
||||
.getSitesMembershipInformation().assertThat().entriesListIsNotEmpty().and().paginationExist().and().paginationField("count").isNot("0");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify site consumer is able to retrieve sites membership information of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is able to retrieve sites membership information of another user")
|
||||
public void siteConsumerIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI()
|
||||
.usingUser(adminUser)
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationExist()
|
||||
.and().paginationField("count").isNot("0");
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingUser(adminUser)
|
||||
.getSitesMembershipInformation().assertThat().entriesListIsNotEmpty().and().paginationExist().and().paginationField("count").isNot("0");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin is able to retrieve sites membership information of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin is able to retrieve sites membership information of another user")
|
||||
public void siteAdminIsAbleToRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationExist()
|
||||
.and().paginationField("count").isNot("0");
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty().and().paginationExist().and().paginationField("count").isNot("0");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY,
|
||||
description = "Verify that unauthenticated user is not able to retrieve sites membership information")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify that unauthenticated user is not able to retrieve sites membership information")
|
||||
@Bug(id = "MNT-16904")
|
||||
public void unauthenticatedUserCannotRetrieveSitesMembershipInformation() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "wrong password");
|
||||
restClient.authenticateUser(inexistentUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.getSitesMembershipInformation();
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.getSitesMembershipInformation();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastException().hasName(StatusModel.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
public class UpdateSiteMembershipRequestCoreTests extends RestTest
|
||||
{
|
||||
private SiteModel siteModel;
|
||||
@@ -22,7 +21,7 @@ public class UpdateSiteMembershipRequestCoreTests extends RestTest
|
||||
private String updatedMessage;
|
||||
private RestSiteMembershipRequestModel returnedResponse;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
managerUser = dataUser.createRandomTestUser();
|
||||
@@ -30,135 +29,101 @@ public class UpdateSiteMembershipRequestCoreTests extends RestTest
|
||||
updatedMessage = "Please review my request";
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify unauthorized user is not able to update user site membership request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify unauthorized user is not able to update user site membership request")
|
||||
public void unauthorizedUserIsNotAbleToUpdateSiteMembershipRequest() throws Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
newMember.setPassword("fakePass");
|
||||
restClient.withCoreAPI()
|
||||
.usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
restClient.withCoreAPI().usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify user is able to update its own site membership request using -me-")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is able to update its own site membership request using -me-")
|
||||
public void usingMeUpdateSiteMembershipRequest() throws Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
returnedResponse = restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("modifiedAt").isNotEmpty();
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage).and().field("id").is(siteModel.getId()).and().field("modifiedAt").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify inexistent user is not able to update its own site membership request")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify inexistent user is not able to update its own site membership request")
|
||||
public void inexistentUserCannotUpdateSiteMembershipRequest() throws Exception
|
||||
{
|
||||
UserModel inexistentUser = UserModel.getRandomUserModel();
|
||||
restClient.authenticateUser(managerUser)
|
||||
.withCoreAPI().usingUser(inexistentUser)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentUser.getUsername()));
|
||||
restClient.authenticateUser(managerUser).withCoreAPI().usingUser(inexistentUser).updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentUser.getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify user is not able to update its own site membership request for inexistent site")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to update its own site membership request for inexistent site")
|
||||
public void userCannotUpdateSiteMembershipRequestForInexistentSite() throws Exception
|
||||
{
|
||||
SiteModel randomSite = SiteModel.getRandomSiteModel();
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember).withCoreAPI()
|
||||
.usingMe()
|
||||
.updateSiteMembershipRequest(randomSite, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), randomSite.getId()));
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingMe().updateSiteMembershipRequest(randomSite, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), randomSite.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify user is able not to update its own site membership request for public site")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is able not to update its own site membership request for public site")
|
||||
public void userCannotUpdateSiteMembershipRequestForPublicSite() throws Exception
|
||||
{
|
||||
SiteModel publicSite = dataSite.usingUser(managerUser).createPublicRandomSite();
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(publicSite);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(publicSite);
|
||||
restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(publicSite, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), publicSite.getId()));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), publicSite.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify user is not able to update its own site membership request for private site")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to update its own site membership request for private site")
|
||||
public void userCannotUpdateSiteMembershipRequestForPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(managerUser).createPrivateRandomSite();
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(privateSite);
|
||||
restClient.withCoreAPI().usingMe()
|
||||
.updateSiteMembershipRequest(privateSite, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), privateSite.getId()));
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(privateSite);
|
||||
restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(privateSite, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), privateSite.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify user is able to update its own site membership request with initial message")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is able to update its own site membership request with initial message")
|
||||
public void userCanUpdateSiteMembershipRequestWithInitialMessage() throws Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(updatedMessage, siteModel, "Accept me");
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(updatedMessage, siteModel, "Accept me");
|
||||
returnedResponse = restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("modifiedAt").isNotEmpty();
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage).and().field("id").is(siteModel.getId()).and().field("modifiedAt").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify user is able to update its own site membership request with different message")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is able to update its own site membership request with different message")
|
||||
public void userCanUpdateSiteMembershipRequestWithDifferentMessage() throws Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest("", siteModel, "Accept me");
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest("", siteModel, "Accept me");
|
||||
returnedResponse = restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("modifiedAt").isNotEmpty();
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage).and().field("id").is(siteModel.getId()).and().field("modifiedAt").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify modifiedAt field for update siteMembership request call")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify modifiedAt field for update siteMembership request call")
|
||||
public void verifyModifiedAtForUpdateSiteMembershipRequest() throws Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
String firstModifiedAt = restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(siteModel, "first message").getModifiedAt();
|
||||
String secondModifiedAt = restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(siteModel, "second message").getModifiedAt();
|
||||
Assert.assertNotEquals(firstModifiedAt, secondModifiedAt);
|
||||
|
||||
+48
-88
@@ -21,7 +21,6 @@ import org.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
public class UpdateSiteMembershipRequestSanityTests extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
@@ -35,155 +34,116 @@ public class UpdateSiteMembershipRequestSanityTests extends RestTest
|
||||
private UserModel adminUser;
|
||||
private String updatedMessage;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
String siteId = RandomData.getRandomName("site");
|
||||
siteModel = dataSite.usingUser(adminUser).createSite(new SiteModel(Visibility.MODERATED, siteId, siteId, siteId, siteId));
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
updatedMessage = "Please review my request";
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify user is able to update its own site membership request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify user is able to update its own site membership request")
|
||||
public void userIsAbleToUpdateItsOwnSiteMembershipRequest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.withCoreAPI().usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage)
|
||||
.assertMembershipRequestMessageIs(updatedMessage)
|
||||
.and().field("id").is(siteModel.getId())
|
||||
.and().field("modifiedAt").isNotEmpty();
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.withCoreAPI().usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage).assertMembershipRequestMessageIs(updatedMessage)
|
||||
.and().field("id").is(siteModel.getId()).and().field("modifiedAt").isNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site manager is not able to update membership request of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site manager is not able to update membership request of another user")
|
||||
@Bug(id = "MNT-16919")
|
||||
public void siteManagerIsNotAbleToUpdateSiteMembershipRequestOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site collaborator is not able to update membership request of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site collaborator is not able to update membership request of another user")
|
||||
@Bug(id = "MNT-16919")
|
||||
public void siteCollaboratorIsNotAbleToUpdateSiteMembershipRequestOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).withCoreAPI().usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site contributor is not able to update membership request of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site contributor is not able to update membership request of another user")
|
||||
@Bug(id = "MNT-16919")
|
||||
public void siteContributorIsNotAbleToUpdateSiteMembershipRequestOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI().usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify site consumer is not able to update membership request of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify site consumer is not able to update membership request of another user")
|
||||
@Bug(id = "MNT-16919")
|
||||
public void siteConsumerIsNotAbleToUpdateSiteMembershipRequestOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify one user is not able to update membership request of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify one user is not able to update membership request of another user")
|
||||
@Bug(id = "MNT-16919")
|
||||
public void oneUserIsNotAbleToUpdateSiteMembershipRequestOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
UserModel otherMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(otherMember)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.authenticateUser(otherMember).withCoreAPI().usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE },
|
||||
executionType = ExecutionType.SANITY, description = "Verify admin is not able to update membership request of another user")
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin is not able to update membership request of another user")
|
||||
@Bug(id = "MNT-16919")
|
||||
public void adminIsNotAbleToUpdateSiteMembershipRequestOfAnotherUser() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel newMember = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(siteModel);
|
||||
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withCoreAPI()
|
||||
.usingUser(newMember)
|
||||
.updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user