mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
REPO-2755 / REPO-2251: changed CORE and FULL groups with REGRESSION in networks package
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class RestGetNetworkCoreTests extends RestTest
|
||||
{
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
UserModel adminuser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminuser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets non existing network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(UserModel.getRandomTenantUser());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
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;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests for /people/{personId}/networks
|
||||
*/
|
||||
public class RestGetNetworkForPersonCoreTests extends RestTest
|
||||
{
|
||||
UserModel adminUser;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
UserModel randomTestUser;
|
||||
RestNetworkModel restNetworkModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
randomTestUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("randomTestUser");
|
||||
}
|
||||
|
||||
@Bug(id = "needs to be checked")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request status code is 200 if a user tries to get network information of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyGetNetworkByAUserForAnotherUser() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(randomTestUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("id").is(tenantUser.getDomain());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that getNetwork status code is 404 for a personId that does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyThatGetNetworkStatusIs404ForAPersonIdThatDoesNotExist() throws Exception
|
||||
{
|
||||
UserModel invalidUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("validUsername");
|
||||
invalidUser.setUsername("invalidUsername");
|
||||
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(invalidUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, invalidUser.getUsername()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that getNetwork status code is 404 for a networkId that does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyThatGetNetworkStatusIs404ForANetworkIdThatDoesNotExist() throws Exception
|
||||
{
|
||||
UserModel invalidUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("invalidNetworkId");
|
||||
invalidUser.setDomain("invalidNetworkId");
|
||||
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(invalidUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, invalidUser.getUsername()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request that is made using -me- instead of personId")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
|
||||
public void verifyGetNetworkRequestUsingMeInsteadOfPersonId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
import org.alfresco.rest.model.RestNetworkQuotaModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests for /people/{personId}/networks
|
||||
*/
|
||||
public class RestGetNetworkForPersonFullTests extends RestTest
|
||||
{
|
||||
UserModel adminUser;
|
||||
UserModel adminTenantUser;
|
||||
UserModel secondAdminTenantUser;
|
||||
UserModel tenantUser;
|
||||
RestNetworkModel restNetworkModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenantUser);
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request response entry details")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void verifyGetNetworkRequestResponseEntryDetails() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("quotas").is(new ArrayList<RestNetworkQuotaModel>())
|
||||
.assertThat().field("isEnabled").is("true")
|
||||
.assertThat().field("homeNetwork").is("true")
|
||||
.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that properties parameter is applied to getNetwork request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void verifyPropertiesParameterIsAppliedToGetNetworkRequest() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(adminTenantUser).withParams("properties=id").withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
// TODO add assert that entry has only 1 field
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request status code is 404 for a network to which user does not belong")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void verifyGetNetworkRequestStatusCodeIs404ForANetworkToWhichTheUserDoesNotBelong() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetwork(secondAdminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
+210
-125
@@ -1,125 +1,210 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
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;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests for /people/{personId}/networks
|
||||
*/
|
||||
public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
{
|
||||
UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
UserModel tenantSiteManager;
|
||||
UserModel tenantSiteCollaborator;
|
||||
UserModel tenantSiteContributor;
|
||||
UserModel tenantSiteConsumer;
|
||||
SiteModel tenantSite;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
tenantSiteManager = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteManager");
|
||||
tenantSiteCollaborator = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteCollaborator");
|
||||
tenantSiteContributor = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteContributor");
|
||||
tenantSiteConsumer = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteConsumer");
|
||||
tenantSite = dataSite.usingUser(tenantSiteManager).createPublicRandomSite();
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteCollaborator, tenantSite, UserRole.SiteCollaborator);
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteContributor, tenantSite, UserRole.SiteContributor);
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteConsumer, tenantSite, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify non existing user gets another existing network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||
{
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(adminTenantUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Bug(id = "needs to be checked")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant user check network of admin user with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin tenant user is not authorized to check network of another user with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetwork(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteManagerChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteManager).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site collaborator user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteCollaboratorChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteCollaborator).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site contributor user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteContributorChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteContributor).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site consumer user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteConsumerChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteConsumer).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
import org.alfresco.rest.model.RestNetworkQuotaModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
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;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Tests for /people/{personId}/networks
|
||||
*/
|
||||
public class RestGetNetworkForPersonTests extends RestTest
|
||||
{
|
||||
UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
UserModel tenantSiteManager;
|
||||
UserModel tenantSiteCollaborator;
|
||||
UserModel tenantSiteContributor;
|
||||
UserModel tenantSiteConsumer;
|
||||
SiteModel tenantSite;
|
||||
RestNetworkModel restNetworkModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
tenantSiteManager = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteManager");
|
||||
tenantSiteCollaborator = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteCollaborator");
|
||||
tenantSiteContributor = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteContributor");
|
||||
tenantSiteConsumer = dataUser.usingUser(adminTenantUser).createUserWithTenant("tenantSiteConsumer");
|
||||
tenantSite = dataSite.usingUser(tenantSiteManager).createPublicRandomSite();
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteCollaborator, tenantSite, UserRole.SiteCollaborator);
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteContributor, tenantSite, UserRole.SiteContributor);
|
||||
dataUser.usingUser(tenantSiteManager).addUserToSite(tenantSiteConsumer, tenantSite, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non existing user gets another existing network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||
{
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(adminTenantUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Bug(id = "needs to be checked")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user check network of admin user with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin tenant user is not authorized to check network of another user with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetwork(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void siteManagerChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteManager).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void siteCollaboratorChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteCollaborator).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void siteContributorChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteContributor).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void siteConsumerChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantSiteConsumer).withCoreAPI().usingAuthUser().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Bug(id = "needs to be checked")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request status code is 200 if a user tries to get network information of another user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void verifyGetNetworkByAUserForAnotherUser() throws Exception
|
||||
{
|
||||
UserModel randomTestUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("randomTestUser");
|
||||
restNetworkModel = restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetwork(randomTestUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("id").is(tenantUser.getDomain());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that getNetwork status code is 404 for a personId that does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void verifyThatGetNetworkStatusIs404ForAPersonIdThatDoesNotExist() throws Exception
|
||||
{
|
||||
UserModel invalidUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("validUsername");
|
||||
invalidUser.setUsername("invalidUsername");
|
||||
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(invalidUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, invalidUser.getUsername()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that getNetwork status code is 404 for a networkId that does not exist")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void verifyThatGetNetworkStatusIs404ForANetworkIdThatDoesNotExist() throws Exception
|
||||
{
|
||||
UserModel invalidUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("invalidNetworkId");
|
||||
invalidUser.setDomain("invalidNetworkId");
|
||||
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(invalidUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, invalidUser.getUsername()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request that is made using -me- instead of personId")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void verifyGetNetworkRequestUsingMeInsteadOfPersonId() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("quotas").is(new ArrayList<RestNetworkQuotaModel>())
|
||||
.assertThat().field("isEnabled").is("true")
|
||||
.assertThat().field("homeNetwork").is("true")
|
||||
.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that properties parameter is applied to getNetwork request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void verifyPropertiesParameterIsAppliedToGetNetworkRequest() throws Exception
|
||||
{
|
||||
restNetworkModel = restClient.authenticateUser(adminTenantUser).withParams("properties=id").withCoreAPI().usingMe().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
restNetworkModel.assertThat().fieldsCount().is(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getNetwork request status code is 404 for a network to which user does not belong")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void verifyGetNetworkRequestStatusCodeIs404ForANetworkToWhichTheUserDoesNotBelong() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel).usingTenant().createTenant(secondAdminTenantUser);
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetwork(secondAdminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
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.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class RestGetNetworkFullTests extends RestTest
|
||||
{
|
||||
UserModel adminTenantUser, adminuser;
|
||||
UserModel adminAnotherTenantUser;
|
||||
SiteModel site;
|
||||
UserModel tenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminuser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminuser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
|
||||
adminAnotherTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(adminAnotherTenantUser);
|
||||
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("userTenant1");
|
||||
site = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5738")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets an invalid network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void adminTenantGetsInvalidNetwork() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminAnotherTenantUser);
|
||||
adminAnotherTenantUser.setDomain("tenant.@%");
|
||||
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminAnotherTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.UNEXPECTED_TENANT, adminTenantUser.getDomain(), "@"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5745")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user gets an existing network successfully with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void adminUserGetsExistingNetwork() throws Exception
|
||||
{
|
||||
RestNetworkModel restNetworkModel = restClient.authenticateUser(adminuser).withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().fieldsCount().is("1");
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain())
|
||||
.and().field("homeNetwork").isNull()
|
||||
.and().field("isEnabled").is("true");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets network using properties parameter successfully with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.FULL })
|
||||
public void adminTenantGetsNetworkUsingPropertiesParameter() throws Exception
|
||||
{
|
||||
JSONObject entryResponse= restClient.authenticateUser(tenantUser).withCoreAPI().usingNetworks().usingParams("properties=id").getNetworkWithParams(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
Assert.assertTrue(entryResponse.get("id").equals(adminTenantUser.getDomain().toLowerCase()));
|
||||
assertJsonResponseDoesnotContainField(entryResponse, "homeNetwork");
|
||||
assertJsonResponseDoesnotContainField(entryResponse, "isEnabled");
|
||||
}
|
||||
|
||||
private void assertJsonResponseDoesnotContainField(JSONObject entryResponse, String field)
|
||||
{
|
||||
try{
|
||||
entryResponse.get(field);
|
||||
}
|
||||
catch(JSONException ex)
|
||||
{
|
||||
Assert.assertTrue(ex.getMessage().equals(String.format("JSONObject[\"%s\"] not found.", field)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+86
-16
@@ -1,6 +1,8 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
@@ -8,24 +10,28 @@ 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.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Cristina Axinte on 9/26/2016.
|
||||
*/
|
||||
public class RestGetNetworkSanityTests extends RestTest
|
||||
public class RestGetNetworkTests extends RestTest
|
||||
{
|
||||
UserModel adminTenantUser;
|
||||
UserModel adminAnotherTenantUser;
|
||||
SiteModel site;
|
||||
UserModel tenantUser;
|
||||
UserModel adminuser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
UserModel adminuser = dataUser.getAdminUser();
|
||||
adminuser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminuser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
@@ -68,9 +74,9 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork().assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets another existing network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void adminTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
@@ -97,9 +103,9 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify any tenant user gets non existing network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void userTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
@@ -107,9 +113,9 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify any tenant user gets another existing network with Rest API and checks the forbidden status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void userTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
@@ -117,9 +123,9 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantManagerUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("manTenant");
|
||||
@@ -130,9 +136,9 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantCollaboratorUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel collaboratorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("colTenant");
|
||||
@@ -143,9 +149,9 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantConsumerUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel consumerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("consTenant");
|
||||
@@ -156,9 +162,9 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantContributorUserChecksIfItsNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel contributorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("contTenant");
|
||||
@@ -168,4 +174,68 @@ public class RestGetNetworkSanityTests extends RestTest
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets non existing network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(UserModel.getRandomTenantUser());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5738")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets an invalid network with Rest API and checks the not found status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void adminTenantGetsInvalidNetwork() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminAnotherTenantUser);
|
||||
adminAnotherTenantUser.setDomain("tenant.@%");
|
||||
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminAnotherTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.UNEXPECTED_TENANT, adminTenantUser.getDomain(), "@"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5745")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user gets an existing network successfully with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void adminUserGetsExistingNetwork() throws Exception
|
||||
{
|
||||
RestNetworkModel restNetworkModel = restClient.authenticateUser(adminuser).withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().fieldsCount().is("1");
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain())
|
||||
.and().field("homeNetwork").isNull()
|
||||
.and().field("isEnabled").is("true");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin user gets network using properties parameter successfully with Rest API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void adminTenantGetsNetworkUsingPropertiesParameter() throws Exception
|
||||
{
|
||||
JSONObject entryResponse= restClient.authenticateUser(tenantUser).withCoreAPI().usingNetworks().usingParams("properties=id").getNetworkWithParams(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
Assert.assertTrue(entryResponse.get("id").equals(adminTenantUser.getDomain().toLowerCase()));
|
||||
assertJsonResponseDoesnotContainField(entryResponse, "homeNetwork");
|
||||
assertJsonResponseDoesnotContainField(entryResponse, "isEnabled");
|
||||
}
|
||||
|
||||
private void assertJsonResponseDoesnotContainField(JSONObject entryResponse, String field)
|
||||
{
|
||||
try{
|
||||
entryResponse.get(field);
|
||||
}
|
||||
catch(JSONException ex)
|
||||
{
|
||||
Assert.assertTrue(ex.getMessage().equals(String.format("JSONObject[\"%s\"] not found.", field)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModelsCollection;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RestGetNetworksForPersonCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using invalid value for skipCount")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void invalidValueForSkipCountTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withParams("skipCount=abc").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using invalid value for maxItems")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void invalidValueForMaxItemsTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withParams("maxItems=abc").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using personId that does not exist")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void inexistentTenantTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(new UserModel("invalidTenantUser", "password")).getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidTenantUser"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using -me- instead of personId")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void specifyMeInsteadOfPersonIdTest() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks and validate network entry")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void checkNetworkEntryTest() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled()
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase())
|
||||
.and().field("quotas").is("[]")
|
||||
.and().field("homeNetwork").is("false");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModelsCollection;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RestGetNetworksForPersonFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private UserModel adminTenantUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check default error schema for get networks for member")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void getNetworksAndCheckErrorSchema() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(new UserModel("invalidUser", "invalidPassword")).getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidUser"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check default error schema for get networks for member")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void getNetworksAndCheckPropertiesParameter() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("properties=isEnabled,id").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertThat().field("homeNetwork").is("false")
|
||||
.and().field("quotas").isNull()
|
||||
.and().field("isEnabled").is("true")
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that skipCount parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void checkThatSkipCountParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("skipCount=1").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that high skipCount parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void checkThatHighSkipCountParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("skipCount=100").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.assertThat().entriesListIsEmpty();
|
||||
networks.assertThat().paginationField("skipCount").is("100");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that maxItems parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void checkThatMaxItemsParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("maxItems=1").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertThat().field("homeNetwork").is("false")
|
||||
.and().field("quotas").is("[]")
|
||||
.and().field("isEnabled").is("true")
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
networks.assertThat().paginationField("maxItems").is("1");
|
||||
}
|
||||
|
||||
}
|
||||
+237
-136
@@ -1,137 +1,238 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
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;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private UserModel adminTenantUser;
|
||||
private UserModel tenantUser;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify non existing user gets another exisiting network with Rest API and checks the unauthorized status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||
{
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant user is not authorized to check network of admin user with Rest API and checks the forbidden status")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin tenant user is not authorized to check network of another user with Rest API and checks the forbidden status")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(secondAdminTenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant manager user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void managerTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("managerTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(managerTenantUser, siteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(managerTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(managerTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant collaborator user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void collaboratorTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel collaboratorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("collaboratorTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(collaboratorTenantUser, siteModel, UserRole.SiteCollaborator);
|
||||
|
||||
restClient.authenticateUser(collaboratorTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(collaboratorTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant contributor user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void contributorTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel contributorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("contributorTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(contributorTenantUser, siteModel, UserRole.SiteContributor);
|
||||
|
||||
restClient.authenticateUser(contributorTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(contributorTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant consumer user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void consumerTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel consumerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("consumerTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(consumerTenantUser, siteModel, UserRole.SiteConsumer);
|
||||
|
||||
restClient.authenticateUser(consumerTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(consumerTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestNetworkModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
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;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RestGetNetworksForPersonTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private UserModel adminTenantUser;
|
||||
private UserModel tenantUser;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify non existing user gets another exisiting network with Rest API and checks the unauthorized status")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void nonExistingTenantUserIsNotAuthorizedToRequest() throws Exception
|
||||
{
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError()
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user is not authorized to check network of admin user with Rest API and checks the forbidden status")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin tenant user is not authorized to check network of another user with Rest API and checks the forbidden status")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(secondAdminTenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant manager user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void managerTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("managerTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(managerTenantUser, siteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(managerTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(managerTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant collaborator user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void collaboratorTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel collaboratorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("collaboratorTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(collaboratorTenantUser, siteModel, UserRole.SiteCollaborator);
|
||||
|
||||
restClient.authenticateUser(collaboratorTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(collaboratorTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant contributor user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void contributorTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel contributorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("contributorTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(contributorTenantUser, siteModel, UserRole.SiteContributor);
|
||||
|
||||
restClient.authenticateUser(contributorTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(contributorTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant consumer user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void consumerTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel consumerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("consumerTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(consumerTenantUser, siteModel, UserRole.SiteConsumer);
|
||||
|
||||
restClient.authenticateUser(consumerTenantUser);
|
||||
RestNetworkModelsCollection networks = restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(consumerTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using invalid value for skipCount")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void invalidValueForSkipCountTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withParams("skipCount=abc").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using invalid value for maxItems")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void invalidValueForMaxItemsTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withParams("maxItems=abc").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using personId that does not exist")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void inexistentTenantTest() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser).withCoreAPI().usingUser(new UserModel("invalidTenantUser", "password")).getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidTenantUser"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks using -me- instead of personId")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void specifyMeInsteadOfPersonIdTest() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingMe().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled().and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get tenant user networks and validate network entry")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void checkNetworkEntryTest() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertNetworkIsEnabled()
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase())
|
||||
.and().field("quotas").is("[]")
|
||||
.and().field("homeNetwork").is("false");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check default error schema for get networks for member")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void getNetworksAndCheckPropertiesParameter() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("properties=isEnabled,id").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertThat().field("homeNetwork").is("false")
|
||||
.and().field("quotas").isNull()
|
||||
.and().field("isEnabled").is("true")
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that skipCount parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void checkThatSkipCountParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("skipCount=1").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that high skipCount parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void checkThatHighSkipCountParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("skipCount=100").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.assertThat().entriesListIsEmpty();
|
||||
networks.assertThat().paginationField("skipCount").is("100");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check that maxItems parameter is applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void checkThatMaxItemsParameterIsApplied() throws Exception
|
||||
{
|
||||
RestNetworkModelsCollection networks = restClient.authenticateUser(adminTenantUser).withParams("maxItems=1").withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networks.getOneRandomEntry().onModel().assertThat().field("homeNetwork").is("false")
|
||||
.and().field("quotas").is("[]")
|
||||
.and().field("isEnabled").is("true")
|
||||
.and().field("id").is(adminTenantUser.getDomain().toLowerCase());
|
||||
networks.assertThat().paginationField("maxItems").is("1");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user