This commit is contained in:
Cristina Jalba
2016-10-04 14:13:21 +03:00
parent f682b0605a
commit 94c0ade52e

View File

@@ -14,17 +14,17 @@ import org.testng.annotations.Test;
@Test(groups = { "rest-api", "networks", "sanity" }) @Test(groups = { "rest-api", "networks", "sanity" })
public class RestGetNetworkForPersonSanityTests extends RestTest public class RestGetNetworkForPersonSanityTests extends RestTest
{ {
@Autowired @Autowired
RestTenantApi tenantApi; RestTenantApi tenantApi;
@Autowired @Autowired
RestNetworksApi networkApi; RestNetworksApi networkApi;
private UserModel adminUserModel; private UserModel adminUserModel;
UserModel adminTenantUser; UserModel adminTenantUser;
UserModel tenantUser; UserModel tenantUser;
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception public void dataPreparation() throws Exception
{ {
@@ -37,7 +37,7 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
tenantUser = dataUser.usingUser(adminTenantUser).createRandomTestUser("uTenant"); tenantUser = dataUser.usingUser(adminTenantUser).createRandomTestUser("uTenant");
networkApi.useRestClient(restClient); networkApi.useRestClient(restClient);
} }
@Test(groups = "sanity") @Test(groups = "sanity")
@TestRail(section = { "rest-api", @TestRail(section = { "rest-api",
"networks" }, executionType = ExecutionType.SANITY, description = "Verify non existing user gets another exisiting network with Rest API and checks the forbidden status") "networks" }, executionType = ExecutionType.SANITY, description = "Verify non existing user gets another exisiting network with Rest API and checks the forbidden status")
@@ -49,7 +49,7 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
networkApi.getNetworkForUser(adminTenantUser); networkApi.getNetworkForUser(adminTenantUser);
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED); networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
} }
@Test(groups = "sanity") @Test(groups = "sanity")
@TestRail(section = { "rest-api", @TestRail(section = { "rest-api",
"networks" }, executionType = ExecutionType.SANITY, description = "Verify tenant admin user gets specific network with Rest API and response is not empty") "networks" }, executionType = ExecutionType.SANITY, description = "Verify tenant admin user gets specific network with Rest API and response is not empty")
@@ -59,4 +59,15 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
networkApi.getNetworkForUser(adminTenantUser); networkApi.getNetworkForUser(adminTenantUser);
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK); networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
} }
@Test(groups = "sanity")
@TestRail(section = { "rest-api",
"networks" }, executionType = ExecutionType.SANITY, description = "Verify tenant user is not authorized to check network of another user with Rest API and checks the forbidden status")
public void tenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
{
restClient.authenticateUser(tenantUser);
networkApi.getNetworkForUser(adminTenantUser);
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
} }