mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-10-08 14:51:20 +00:00
TAS-713 getNetwork API tests
This commit is contained in:
123
e2e-test/java/org/alfresco/rest/RestNetworksTest.java
Normal file
123
e2e-test/java/org/alfresco/rest/RestNetworksTest.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package org.alfresco.rest;
|
||||
|
||||
import org.alfresco.rest.requests.RestNetworksApi;
|
||||
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", "sanity" })
|
||||
public class RestNetworksTest extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestNetworksApi networkApi;
|
||||
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
|
||||
@BeforeClass
|
||||
public void setup()
|
||||
{
|
||||
// input data should be created for handle tenants:
|
||||
// create tenant "tenant1" with password "password"
|
||||
|
||||
// with admin "admin@tenant1" create user "test1@tenant1" with password "password"
|
||||
adminTenantUser = new UserModel("admin@tenant1", "password");
|
||||
tenantUser = new UserModel("test1@tenant1", "password");
|
||||
}
|
||||
|
||||
@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
|
||||
{
|
||||
String tenantName = "tenant1";
|
||||
UserModel tenantUser = new UserModel("nonexisting@tenant1", "password");
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
|
||||
}
|
||||
|
||||
@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
|
||||
{
|
||||
String tenantName = "tenant1";
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||
}
|
||||
|
||||
@TestRail(section = { "rest-api", "networks" }, executionType = ExecutionType.SANITY, description = "Verify tenant admin user gets specific network with Rest API and checks response parameters are correct")
|
||||
public void adminTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||
{
|
||||
String tenantName = "tenant1";
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName).assertNetworkHasName(tenantName).assertNetworkIsEnabled(true);
|
||||
}
|
||||
|
||||
@TestRail(section = { "rest-api", "networks" }, executionType = ExecutionType.SANITY, description = "Verify tenant admin user gets non exisiting network with Rest API and checks the not found status")
|
||||
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
String tenantName = "netenant";
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND.toString());
|
||||
}
|
||||
|
||||
@TestRail(section = { "rest-api", "networks" }, executionType = ExecutionType.SANITY, description = "Verify tenant admin user gets another exisiting network with Rest API and checks the forbidden status")
|
||||
public void adminTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||
{
|
||||
String tenantName = "tenant2";
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN.toString());
|
||||
}
|
||||
|
||||
@TestRail(section = { "rest-api", "networks" }, executionType = ExecutionType.SANITY, description = "Verify any tenant user gets its network with Rest API and response is not empty")
|
||||
public void userTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
String tenantName = "tenant1";
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||
}
|
||||
|
||||
@TestRail(section = { "rest-api", "networks" }, executionType = ExecutionType.SANITY, description = "Verify any tenant user gets specific network with Rest API and checks response parameters are correct")
|
||||
public void userTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||
{
|
||||
String tenantName = "tenant1";
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName).assertNetworkHasName(tenantName).assertNetworkIsEnabled(true);
|
||||
}
|
||||
|
||||
@TestRail(section = { "rest-api", "networks" }, executionType = ExecutionType.SANITY, description = "Verify any tenant user gets non exisiting network with Rest API and checks the not found status")
|
||||
public void userTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
String tenantName = "netenant";
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND.toString());
|
||||
}
|
||||
|
||||
@TestRail(section = { "rest-api", "networks" }, executionType = ExecutionType.SANITY, description = "Verify any tenant user gets another exisiting network with Rest API and checks the forbidden status")
|
||||
public void userTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||
{
|
||||
String tenantName = "tenant2";
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.useRestClient(restClient);
|
||||
networkApi.getNetwork(tenantName);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN.toString());
|
||||
}
|
||||
}
|
@@ -5,7 +5,6 @@ import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestCommentModel;
|
||||
import org.alfresco.rest.requests.RestCommentsApi;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
@@ -20,9 +19,6 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { "rest-api", "comments", "sanity" })
|
||||
public class SampleCommentsTest extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
RestCommentsApi commentsAPI;
|
||||
|
||||
|
@@ -2,7 +2,6 @@ package org.alfresco.rest.demo;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.requests.RestPeopleApi;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
@@ -19,9 +18,6 @@ public class SamplePeopleTest extends RestTest
|
||||
@Autowired
|
||||
RestPeopleApi peopleAPI;
|
||||
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
private UserModel userModel;
|
||||
private UserModel adminUser;
|
||||
|
||||
|
@@ -4,8 +4,6 @@ import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.body.SiteMember;
|
||||
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.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
@@ -23,12 +21,6 @@ public class SampleSitesTest extends RestTest
|
||||
@Autowired
|
||||
RestSitesApi siteAPI;
|
||||
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
DataSite dataSite;
|
||||
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
# dataprep related
|
||||
alfresco.scheme=http
|
||||
alfresco.server=172.29.100.206
|
||||
alfresco.port=8070
|
||||
alfresco.server=172.29.100.215
|
||||
alfresco.port=8080
|
||||
|
||||
# credentials
|
||||
admin.user=admin
|
||||
admin.password=admin
|
||||
|
||||
# rest related
|
||||
rest.basePath=alfresco/api/-default-/public/alfresco/versions/1
|
||||
rest.basePath=alfresco/api/tenant1/public/alfresco/versions/1
|
||||
|
||||
|
||||
# TEST MANAGEMENT SECTION - Test Rail
|
||||
|
Reference in New Issue
Block a user