mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-10-01 14:41:19 +00:00
TAS-898 getSite status code 401 with Manager role
This commit is contained in:
committed by
Iulia Nechita
parent
16758317b8
commit
a316935c77
@@ -23,7 +23,7 @@ import org.testng.annotations.Test;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Test(groups = { "rest-api", "sites", "sanity" })
|
@Test(groups = { "rest-api", "sites", "sanity" })
|
||||||
public class GetSiteTests extends RestTest
|
public class GetSiteSanityTests extends RestTest
|
||||||
{
|
{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -37,12 +37,13 @@ public class GetSiteTests extends RestTest
|
|||||||
|
|
||||||
private UserModel adminUserModel;
|
private UserModel adminUserModel;
|
||||||
private HashMap<UserRole, UserModel> usersWithRoles;
|
private HashMap<UserRole, UserModel> usersWithRoles;
|
||||||
|
private UserModel userModel;
|
||||||
private SiteModel siteModel;
|
private SiteModel siteModel;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void initTest() throws DataPreparationException
|
public void initTest() throws DataPreparationException
|
||||||
{
|
{
|
||||||
adminUserModel = dataUser.createRandomTestUser();
|
adminUserModel = dataUser.getAdminUser();
|
||||||
restClient.authenticateUser(adminUserModel);
|
restClient.authenticateUser(adminUserModel);
|
||||||
siteAPI.useRestClient(restClient);
|
siteAPI.useRestClient(restClient);
|
||||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||||
@@ -50,48 +51,60 @@ public class GetSiteTests extends RestTest
|
|||||||
Arrays.asList(UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor));
|
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)")
|
@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
|
public void getSiteWithManagerRole() throws JsonToModelConversionException, Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteManager));
|
||||||
siteAPI.getSite(siteModel.getId());
|
siteAPI.getSite(siteModel.getId());
|
||||||
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
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)")
|
@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
|
public void getSiteWithCollaboratorRole() throws JsonToModelConversionException, Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteCollaborator));
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteCollaborator));
|
||||||
siteAPI.getSite(siteModel.getId());
|
siteAPI.getSite(siteModel.getId());
|
||||||
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
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)")
|
@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
|
public void getSiteWithContributorRole() throws JsonToModelConversionException, Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteContributor));
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteContributor));
|
||||||
siteAPI.getSite(siteModel.getId());
|
siteAPI.getSite(siteModel.getId());
|
||||||
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
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)")
|
@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
|
public void getSiteWithConsumerRole() throws JsonToModelConversionException, Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteConsumer));
|
restClient.authenticateUser(usersWithRoles.get(UserRole.SiteConsumer));
|
||||||
siteAPI.getSite(siteModel.getId());
|
siteAPI.getSite(siteModel.getId());
|
||||||
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
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)")
|
@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
|
public void getSiteWithAdminRole() throws JsonToModelConversionException, Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
restClient.authenticateUser(adminUserModel);
|
restClient.authenticateUser(adminUserModel);
|
||||||
siteAPI.getSite(siteModel.getId());
|
siteAPI.getSite(siteModel.getId());
|
||||||
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user