mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-10-01 14:41:19 +00:00
Merge branch 'master' of https://gitlab.alfresco.com/tas/alfresco-tas-restapi-test into TAS-704
This commit is contained in:
110
e2e-test/java/org/alfresco/rest/GetSiteSanityTests.java
Normal file
110
e2e-test/java/org/alfresco/rest/GetSiteSanityTests.java
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
package org.alfresco.rest;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||||
|
import org.alfresco.rest.requests.RestSitesApi;
|
||||||
|
import org.alfresco.utility.data.DataSite;
|
||||||
|
import org.alfresco.utility.data.DataUser;
|
||||||
|
import org.alfresco.utility.data.UserRole;
|
||||||
|
import org.alfresco.utility.exception.DataPreparationException;
|
||||||
|
import org.alfresco.utility.model.SiteModel;
|
||||||
|
import org.alfresco.utility.model.UserModel;
|
||||||
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author iulia.cojocea
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test(groups = { "rest-api", "sites", "sanity" })
|
||||||
|
public class GetSiteSanityTests extends RestTest
|
||||||
|
{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataUser dataUser;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RestSitesApi siteAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataSite dataSite;
|
||||||
|
|
||||||
|
private UserModel adminUserModel;
|
||||||
|
private HashMap<UserRole, UserModel> usersWithRoles;
|
||||||
|
private UserModel userModel;
|
||||||
|
private SiteModel siteModel;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public void initTest() throws DataPreparationException
|
||||||
|
{
|
||||||
|
adminUserModel = dataUser.getAdminUser();
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
siteAPI.useRestClient(restClient);
|
||||||
|
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||||
|
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
|
||||||
|
Arrays.asList(UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor));
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Manager role gets site information and gets status code OK (200)")
|
||||||
|
public void getSiteWithManagerRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
|
siteAPI.getSite(siteModel.getId());
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Collaborator role gets site information and gets status code OK (200)")
|
||||||
|
public void getSiteWithCollaboratorRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteCollaborator));
|
||||||
|
siteAPI.getSite(siteModel.getId());
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Contributor role gets site information and gets status code OK (200)")
|
||||||
|
public void getSiteWithContributorRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteContributor));
|
||||||
|
siteAPI.getSite(siteModel.getId());
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Consumer role gets site information and gets status code OK (200)")
|
||||||
|
public void getSiteWithConsumerRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteConsumer));
|
||||||
|
siteAPI.getSite(siteModel.getId());
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with admin role gets site information and gets status code OK (200)")
|
||||||
|
public void getSiteWithAdminRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
siteAPI.getSite(siteModel.getId());
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Failed authentication get site call returns status code 401 with Manager role")
|
||||||
|
public void getSiteWithManagerRoleFailedAuth() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
userModel = dataUser.createRandomTestUser();
|
||||||
|
userModel.setPassword("user wrong password");
|
||||||
|
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||||
|
restClient.authenticateUser(userModel);
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
|
||||||
|
}
|
||||||
|
}
|
111
e2e-test/java/org/alfresco/rest/GetSitesSanityTests.java
Normal file
111
e2e-test/java/org/alfresco/rest/GetSitesSanityTests.java
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
package org.alfresco.rest;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||||
|
import org.alfresco.rest.requests.RestSitesApi;
|
||||||
|
import org.alfresco.utility.data.DataSite;
|
||||||
|
import org.alfresco.utility.data.DataUser;
|
||||||
|
import org.alfresco.utility.data.UserRole;
|
||||||
|
import org.alfresco.utility.model.SiteModel;
|
||||||
|
import org.alfresco.utility.model.UserModel;
|
||||||
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author iulia.cojocea
|
||||||
|
*/
|
||||||
|
@Test(groups = { "rest-api", "sites", "sanity" })
|
||||||
|
public class GetSitesSanityTests extends RestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
RestSitesApi siteAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataUser dataUser;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataSite dataSite;
|
||||||
|
|
||||||
|
private UserModel adminUserModel;
|
||||||
|
private UserModel userModel;
|
||||||
|
private HashMap<UserRole, UserModel> usersWithRoles;
|
||||||
|
private SiteModel siteModel;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public void initTest() throws Exception
|
||||||
|
{
|
||||||
|
adminUserModel = dataUser.getAdminUser();
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
siteAPI.useRestClient(restClient);
|
||||||
|
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||||
|
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
|
||||||
|
Arrays.asList(UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor));
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY, description = "Verify user with Manager role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithManagerRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Collaborator role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithCollaboratorRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteCollaborator));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Contributor role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithContributorRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteContributor));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Consumer role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithConsumerRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteConsumer));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify user with Admin user gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithAdminUser() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Failed authentication get sites call returns status code 401 with Manager role")
|
||||||
|
public void getSitesWithManagerRoleFailedAuth() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
|
userModel = dataUser.createRandomTestUser();
|
||||||
|
userModel.setPassword("user wrong password");
|
||||||
|
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||||
|
restClient.authenticateUser(userModel);
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
|
||||||
|
}
|
||||||
|
}
|
107
e2e-test/java/org/alfresco/rest/GetSitesTests.java
Normal file
107
e2e-test/java/org/alfresco/rest/GetSitesTests.java
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
package org.alfresco.rest;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||||
|
import org.alfresco.rest.requests.RestSitesApi;
|
||||||
|
import org.alfresco.utility.data.DataSite;
|
||||||
|
import org.alfresco.utility.data.DataUser;
|
||||||
|
import org.alfresco.utility.data.UserRole;
|
||||||
|
import org.alfresco.utility.model.SiteModel;
|
||||||
|
import org.alfresco.utility.model.UserModel;
|
||||||
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author iulia.cojocea
|
||||||
|
*/
|
||||||
|
@Test(groups = { "rest-api", "comments", "sanity" })
|
||||||
|
public class GetSitesTests extends RestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
RestSitesApi siteAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataUser dataUser;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataSite dataSite;
|
||||||
|
|
||||||
|
private UserModel adminUserModel;
|
||||||
|
private UserModel userModel;
|
||||||
|
private HashMap<UserRole, UserModel> usersWithRoles;
|
||||||
|
private SiteModel siteModel;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public void initTest() throws Exception
|
||||||
|
{
|
||||||
|
adminUserModel = dataUser.getAdminUser();
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
siteAPI.useRestClient(restClient);
|
||||||
|
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||||
|
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,
|
||||||
|
Arrays.asList(UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY, description = "Verify user with Manager role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithManagerRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY, description = "Verify user with Collaborator role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithCollaboratorRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteCollaborator));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY, description = "Verify user with Contributor role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithContributorRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteContributor));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY, description = "Verify user with Consumer role gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithConsumerRole() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteConsumer));
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY, description = "Verify user with Admin user gets sites information and gets status code OK (200)")
|
||||||
|
public void getSitesWithAdminUser() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "sites" }, executionType = ExecutionType.SANITY, description = "Failed authentication get sites call returns status code 401 with Manager role")
|
||||||
|
public void getSitesWithManagerRoleFailedAuth() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
|
userModel = dataUser.createRandomTestUser();
|
||||||
|
userModel.setPassword("user wrong password");
|
||||||
|
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||||
|
restClient.authenticateUser(userModel);
|
||||||
|
siteAPI.getAllSites();
|
||||||
|
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,130 @@
|
|||||||
|
package org.alfresco.rest.comments;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||||
|
import org.alfresco.rest.RestTest;
|
||||||
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||||
|
import org.alfresco.rest.requests.RestCommentsApi;
|
||||||
|
import org.alfresco.utility.data.DataUser;
|
||||||
|
import org.alfresco.utility.data.UserRole;
|
||||||
|
import org.alfresco.utility.model.FileModel;
|
||||||
|
import org.alfresco.utility.model.SiteModel;
|
||||||
|
import org.alfresco.utility.model.UserModel;
|
||||||
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@Test(groups = { "rest-api", "comments", "sanity" })
|
||||||
|
public class GetCommentsSanityTest extends RestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
RestCommentsApi commentsAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataUser dataUser;
|
||||||
|
|
||||||
|
private UserModel adminUserModel;
|
||||||
|
|
||||||
|
private FileModel document;
|
||||||
|
private SiteModel siteModel;
|
||||||
|
private UserModel userModel;
|
||||||
|
private HashMap<UserRole, UserModel> usersWithRoles;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public void initTest() throws Exception
|
||||||
|
{
|
||||||
|
adminUserModel = dataUser.getAdminUser();
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||||
|
commentsAPI.useRestClient(restClient);
|
||||||
|
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||||
|
commentsAPI.addComment(document.getNodeRef(), "This is a new comment");
|
||||||
|
|
||||||
|
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, Arrays.asList(UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor));
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify Admin user gets comments with Rest API and status code is 200")
|
||||||
|
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify Manager user gets comments created by admin user with Rest API and status code is 200")
|
||||||
|
public void managerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify Contributor user gets comments created by admin user with Rest API and status code is 200")
|
||||||
|
public void contributorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteContributor));
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify Collaborator user gets comments created by admin user with Rest API and status code is 200")
|
||||||
|
public void collaboratorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteCollaborator));
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify Consumer user gets comments created by admin user with Rest API and status code is 200")
|
||||||
|
public void consumerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteConsumer));
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify Manager user gets status code 401 if authentication call fails")
|
||||||
|
public void managerIsNotAbleToRetrieveCommentIfAuthenticationFails() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
|
||||||
|
restClient.authenticateUser(nonexistentModel);
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify Manager user gets comments created by another user and status code is 200")
|
||||||
|
public void managerIsAbleToRetrieveCommentsCreatedByAnotherUser() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
userModel = usersWithRoles.get(UserRole.SiteCollaborator);
|
||||||
|
restClient.authenticateUser(userModel);
|
||||||
|
commentsAPI.addComment(document.getNodeRef(), "This is a new comment added by " + userModel.getUsername());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED.toString());
|
||||||
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify admin user gets comments created by another user and status code is 200")
|
||||||
|
public void adminIsAbleToRetrieveCommentsCreatedByAnotherUser() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
userModel = usersWithRoles.get(UserRole.SiteCollaborator);
|
||||||
|
restClient.authenticateUser(userModel);
|
||||||
|
commentsAPI.addComment(document.getNodeRef(), "This is a new comment added by " + userModel.getUsername());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED.toString());
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user