mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
REPO-2755 / REPO-2251: deleted duplicates from network package
This commit is contained in:
@@ -4,8 +4,6 @@ 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;
|
||||
@@ -22,14 +20,9 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class RestGetNetworkForPersonTests extends RestTest
|
||||
{
|
||||
UserModel adminUserModel;
|
||||
UserModel adminUserModel, secondAdminTenantUser;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
UserModel tenantSiteManager;
|
||||
UserModel tenantSiteCollaborator;
|
||||
UserModel tenantSiteContributor;
|
||||
UserModel tenantSiteConsumer;
|
||||
SiteModel tenantSite;
|
||||
RestNetworkModel restNetworkModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
@@ -40,19 +33,13 @@ public class RestGetNetworkForPersonTests extends RestTest
|
||||
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);
|
||||
secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
}
|
||||
|
||||
@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")
|
||||
@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
|
||||
{
|
||||
@@ -62,8 +49,8 @@ public class RestGetNetworkForPersonTests extends RestTest
|
||||
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")
|
||||
@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
|
||||
{
|
||||
@@ -71,67 +58,28 @@ public class RestGetNetworkForPersonTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.NETWORKS }, executionType = ExecutionType.SANITY, description = "Verify tenant user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void tenantUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingUser(tenantUser).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")
|
||||
@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")
|
||||
@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
|
||||
{
|
||||
@@ -141,8 +89,8 @@ public class RestGetNetworkForPersonTests extends RestTest
|
||||
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")
|
||||
@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
|
||||
{
|
||||
@@ -150,15 +98,13 @@ public class RestGetNetworkForPersonTests extends RestTest
|
||||
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)
|
||||
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")
|
||||
@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
|
||||
{
|
||||
@@ -166,49 +112,51 @@ public class RestGetNetworkForPersonTests extends RestTest
|
||||
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)
|
||||
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")
|
||||
@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());
|
||||
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")
|
||||
@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,isEnabled,homeNetwork,paidNetwork").withCoreAPI().usingMe().getNetwork();
|
||||
restNetworkModel = restClient.authenticateUser(adminTenantUser).withParams("properties=id,isEnabled,homeNetwork,paidNetwork").withCoreAPI().usingMe()
|
||||
.getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase())
|
||||
.assertThat().field("isEnabled").is("true")
|
||||
.assertThat().field("homeNetwork").is("true")
|
||||
.assertThat().field("paidNetwork").is("false")
|
||||
.assertThat().field("quotas").isNull();
|
||||
restNetworkModel.assertThat().field("id").is(adminTenantUser.getDomain().toLowerCase()).assertThat().field("isEnabled").is("true").assertThat()
|
||||
.field("homeNetwork").is("true").assertThat().field("paidNetwork").is("false").assertThat().field("quotas").isNull();
|
||||
restNetworkModel.assertThat().fieldsCount().is(4);
|
||||
}
|
||||
|
||||
@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")
|
||||
@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);
|
||||
}
|
||||
|
||||
@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 secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(secondAdminTenantUser).withCoreAPI().usingAuthUser().getNetwork(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ public class RestGetNetworkTests extends RestTest
|
||||
{
|
||||
UserModel adminTenantUser;
|
||||
UserModel adminAnotherTenantUser;
|
||||
SiteModel site;
|
||||
UserModel tenantUser;
|
||||
UserModel adminuser;
|
||||
|
||||
@@ -39,7 +38,6 @@ public class RestGetNetworkTests extends RestTest
|
||||
restClient.usingTenant().createTenant(adminAnotherTenantUser);
|
||||
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
site = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@@ -59,19 +57,10 @@ public class RestGetNetworkTests extends RestTest
|
||||
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);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify tenant admin user gets specific network with Rest API and checks response parameters are correct")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void adminTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork().assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -88,19 +77,10 @@ public class RestGetNetworkTests extends RestTest
|
||||
description = "Verify any tenant user gets its network with Rest API and response is not empty")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void userTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify any tenant user gets specific network with Rest API and checks response parameters are correct")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public void userTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -123,68 +103,6 @@ public class RestGetNetworkTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@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.REGRESSION })
|
||||
public void tenantManagerUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel managerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("manTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(managerTenantUser, site, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(managerTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@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.REGRESSION })
|
||||
public void tenantCollaboratorUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel collaboratorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("colTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(collaboratorTenantUser, site, UserRole.SiteCollaborator);
|
||||
|
||||
restClient.authenticateUser(collaboratorTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@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.REGRESSION })
|
||||
public void tenantConsumerUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel consumerTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("consTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(consumerTenantUser, site, UserRole.SiteConsumer);
|
||||
|
||||
restClient.authenticateUser(consumerTenantUser);
|
||||
restClient.withCoreAPI().usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@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.REGRESSION })
|
||||
public void tenantContributorUserChecksIfItsNetworkIsPresent() throws Exception
|
||||
{
|
||||
UserModel contributorTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("contTenant");
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(contributorTenantUser, site, UserRole.SiteContributor);
|
||||
|
||||
restClient.authenticateUser(contributorTenantUser);
|
||||
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")
|
||||
|
||||
@@ -16,10 +16,9 @@ import org.testng.annotations.Test;
|
||||
|
||||
public class RestGetNetworksForPersonTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private UserModel adminUserModel, secondAdminTenantUser;
|
||||
private UserModel adminTenantUser;
|
||||
private UserModel tenantUser;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -29,7 +28,8 @@ public class RestGetNetworksForPersonTests extends RestTest
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@@ -51,8 +51,20 @@ public class RestGetNetworksForPersonTests extends RestTest
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks();
|
||||
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.SANITY,
|
||||
description = "Verify tenant user gets specific network with Rest API and response is not empty")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.SANITY, TestGroup.NETWORKS })
|
||||
public void tenantUserChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -71,69 +83,11 @@ public class RestGetNetworksForPersonTests extends RestTest
|
||||
@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")
|
||||
@@ -175,19 +129,6 @@ public class RestGetNetworksForPersonTests extends RestTest
|
||||
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 })
|
||||
|
||||
Reference in New Issue
Block a user