mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-24 14:31:29 +00:00
Merge branch 'TAS-713' of gitlab.alfresco.com:tas/alfresco-tas-restapi-test
# Conflicts: # src/test/resources/sanity-rest.xml
This commit is contained in:
@@ -5,7 +5,6 @@ import org.alfresco.rest.RestTest;
|
|||||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||||
import org.alfresco.rest.model.RestCommentModel;
|
import org.alfresco.rest.model.RestCommentModel;
|
||||||
import org.alfresco.rest.requests.RestCommentsApi;
|
import org.alfresco.rest.requests.RestCommentsApi;
|
||||||
import org.alfresco.utility.data.DataUser;
|
|
||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.SiteModel;
|
import org.alfresco.utility.model.SiteModel;
|
||||||
@@ -20,9 +19,6 @@ import org.testng.annotations.Test;
|
|||||||
@Test(groups = { "demo" })
|
@Test(groups = { "demo" })
|
||||||
public class SampleCommentsTests extends RestTest
|
public class SampleCommentsTests extends RestTest
|
||||||
{
|
{
|
||||||
@Autowired
|
|
||||||
DataUser dataUser;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RestCommentsApi commentsAPI;
|
RestCommentsApi commentsAPI;
|
||||||
|
|
||||||
|
@@ -2,7 +2,6 @@ package org.alfresco.rest.demo;
|
|||||||
|
|
||||||
import org.alfresco.rest.RestTest;
|
import org.alfresco.rest.RestTest;
|
||||||
import org.alfresco.rest.requests.RestPeopleApi;
|
import org.alfresco.rest.requests.RestPeopleApi;
|
||||||
import org.alfresco.utility.data.DataUser;
|
|
||||||
import org.alfresco.utility.exception.DataPreparationException;
|
import org.alfresco.utility.exception.DataPreparationException;
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
@@ -19,9 +18,6 @@ public class SamplePeopleTests extends RestTest
|
|||||||
@Autowired
|
@Autowired
|
||||||
RestPeopleApi peopleAPI;
|
RestPeopleApi peopleAPI;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
DataUser dataUser;
|
|
||||||
|
|
||||||
private UserModel userModel;
|
private UserModel userModel;
|
||||||
private UserModel adminUser;
|
private UserModel adminUser;
|
||||||
|
|
||||||
|
@@ -4,8 +4,6 @@ import org.alfresco.rest.RestTest;
|
|||||||
import org.alfresco.rest.body.SiteMember;
|
import org.alfresco.rest.body.SiteMember;
|
||||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||||
import org.alfresco.rest.requests.RestSitesApi;
|
import org.alfresco.rest.requests.RestSitesApi;
|
||||||
import org.alfresco.utility.data.DataSite;
|
|
||||||
import org.alfresco.utility.data.DataUser;
|
|
||||||
import org.alfresco.utility.exception.DataPreparationException;
|
import org.alfresco.utility.exception.DataPreparationException;
|
||||||
import org.alfresco.utility.model.SiteModel;
|
import org.alfresco.utility.model.SiteModel;
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
@@ -23,12 +21,6 @@ public class SampleSitesTests extends RestTest
|
|||||||
@Autowired
|
@Autowired
|
||||||
RestSitesApi siteAPI;
|
RestSitesApi siteAPI;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
DataUser dataUser;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
DataSite dataSite;
|
|
||||||
|
|
||||||
private UserModel userModel;
|
private UserModel userModel;
|
||||||
private SiteModel siteModel;
|
private SiteModel siteModel;
|
||||||
|
|
||||||
|
187
e2e-test/java/org/alfresco/rest/networks/RestGetNetworkTest.java
Normal file
187
e2e-test/java/org/alfresco/rest/networks/RestGetNetworkTest.java
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
package org.alfresco.rest.networks;
|
||||||
|
|
||||||
|
import org.alfresco.rest.RestTest;
|
||||||
|
import org.alfresco.rest.requests.RestNetworksApi;
|
||||||
|
import org.alfresco.rest.requests.RestTenantApi;
|
||||||
|
import org.alfresco.utility.constants.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Cristina Axinte on 9/26/2016.
|
||||||
|
*/
|
||||||
|
@Test(groups = { "rest-api", "networks" })
|
||||||
|
public class RestGetNetworkTest extends RestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
RestNetworksApi networkApi;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RestTenantApi tenantApi;
|
||||||
|
|
||||||
|
UserModel adminTenantUser;
|
||||||
|
UserModel adminAnotherTenantUser;
|
||||||
|
SiteModel site;
|
||||||
|
UserModel tenantUser;
|
||||||
|
UserModel managerTenantUser;
|
||||||
|
UserModel collaboratorTenantUser;
|
||||||
|
UserModel consumerTenantUser;
|
||||||
|
UserModel contributorTenantUser;
|
||||||
|
|
||||||
|
@BeforeClass(alwaysRun = true)
|
||||||
|
public void dataPreparation() throws Exception
|
||||||
|
{
|
||||||
|
UserModel adminuser = dataUser.getAdminUser();
|
||||||
|
adminTenantUser = UserModel.getAdminTenantUser();
|
||||||
|
restClient.authenticateUser(adminuser);
|
||||||
|
tenantApi.useRestClient(restClient);
|
||||||
|
tenantApi.createTenant(adminTenantUser);
|
||||||
|
adminAnotherTenantUser = UserModel.getAdminTenantUser();
|
||||||
|
tenantApi.createTenant(adminAnotherTenantUser);
|
||||||
|
|
||||||
|
tenantUser = dataUser.usingUser(adminTenantUser).createRandomTestUser("uTenant");
|
||||||
|
site = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||||
|
|
||||||
|
networkApi.useRestClient(restClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = "sanity")
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, executionType = ExecutionType.SANITY, description = "Verify non existing user gets another exisiting network with Rest API and checks the forbidden status")
|
||||||
|
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||||
|
{
|
||||||
|
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||||
|
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||||
|
restClient.authenticateUser(tenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = "sanity")
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, executionType = ExecutionType.SANITY, description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||||
|
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(adminTenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, description = "Verify tenant admin user gets specific network with Rest API and checks response parameters are correct")
|
||||||
|
public void adminTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(adminTenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, description = "Verify tenant admin user gets non exisiting network with Rest API and checks the not found status")
|
||||||
|
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(adminTenantUser);
|
||||||
|
networkApi.getNetwork(UserModel.getRandomTenantUser());
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, description = "Verify tenant admin user gets another exisiting network with Rest API and checks the forbidden status")
|
||||||
|
public void adminTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(adminTenantUser);
|
||||||
|
networkApi.getNetwork(adminAnotherTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api", "networks" }, description = "Verify any tenant user gets its network with Rest API and response is not empty")
|
||||||
|
public void userTenantChecksIfNetworkIsPresent() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(tenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, description = "Verify any tenant user gets specific network with Rest API and checks response parameters are correct")
|
||||||
|
public void userTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(tenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, description = "Verify any tenant user gets non exisiting network with Rest API and checks the not found status")
|
||||||
|
public void userTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(tenantUser);
|
||||||
|
networkApi.getNetwork(UserModel.getRandomTenantUser());
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, description = "Verify any tenant user gets another exisiting network with Rest API and checks the forbidden status")
|
||||||
|
public void userTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||||
|
{
|
||||||
|
restClient.authenticateUser(tenantUser);
|
||||||
|
networkApi.getNetwork(adminAnotherTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = "sanity")
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, executionType = ExecutionType.SANITY, description = "Verify manager tenant user gets its network with Rest API and response is not empty")
|
||||||
|
public void tenantManagerUserChecksIfNetworkIsPresent() throws Exception
|
||||||
|
{
|
||||||
|
managerTenantUser = dataUser.usingUser(adminTenantUser).createRandomTestUser("manTenant");
|
||||||
|
dataUser.usingUser(adminTenantUser).addUserToSite(managerTenantUser, site, UserRole.SiteManager);
|
||||||
|
|
||||||
|
restClient.authenticateUser(managerTenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = "sanity")
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, executionType = ExecutionType.SANITY, description = "Verify collaborator tenant user gets its network with Rest API and response is not empty")
|
||||||
|
public void tenantCollaboratorUserChecksIfNetworkIsPresent() throws Exception
|
||||||
|
{
|
||||||
|
collaboratorTenantUser = dataUser.usingUser(adminTenantUser).createRandomTestUser("colTenant");
|
||||||
|
dataUser.usingUser(adminTenantUser).addUserToSite(collaboratorTenantUser, site, UserRole.SiteCollaborator);
|
||||||
|
|
||||||
|
restClient.authenticateUser(collaboratorTenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = "sanity")
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, executionType = ExecutionType.SANITY, description = "Verify consumer tenant user gets its network with Rest API and response is not empty")
|
||||||
|
public void tenantConsumerUserChecksIfNetworkIsPresent() throws Exception
|
||||||
|
{
|
||||||
|
consumerTenantUser = dataUser.usingUser(adminTenantUser).createRandomTestUser("contTenant");
|
||||||
|
dataUser.usingUser(adminTenantUser).addUserToSite(consumerTenantUser, site, UserRole.SiteConsumer);
|
||||||
|
|
||||||
|
restClient.authenticateUser(consumerTenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = "sanity")
|
||||||
|
@TestRail(section = { "rest-api",
|
||||||
|
"networks" }, executionType = ExecutionType.SANITY, description = "Verify contributor tenant user gets its network with Rest API and response is not empty")
|
||||||
|
public void tenantContributorUserChecksIfNetworkIsPresent() throws Exception
|
||||||
|
{
|
||||||
|
contributorTenantUser = dataUser.usingUser(adminTenantUser).createRandomTestUser("contTenant");
|
||||||
|
dataUser.usingUser(adminTenantUser).addUserToSite(contributorTenantUser, site, UserRole.SiteContributor);
|
||||||
|
|
||||||
|
restClient.authenticateUser(contributorTenantUser);
|
||||||
|
networkApi.getNetwork(adminTenantUser);
|
||||||
|
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
# dataprep related
|
# dataprep related
|
||||||
alfresco.scheme=http
|
alfresco.scheme=http
|
||||||
alfresco.server=172.29.100.206
|
alfresco.server=172.29.100.215
|
||||||
alfresco.port=8070
|
alfresco.port=8080
|
||||||
|
|
||||||
# credentials
|
# credentials
|
||||||
admin.user=admin
|
admin.user=admin
|
||||||
|
Reference in New Issue
Block a user