test: Added valid values for skipCount and maxItems

This commit is contained in:
Alecsandru Prună
2016-12-06 10:41:39 +02:00
parent 105ab7c7a3
commit c2f893dffd
2 changed files with 59 additions and 0 deletions
@@ -43,6 +43,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
.usingMe()
.addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
restClient.assertLastError().containsSummary(String.format("%s is already a member of site %s", newMember.getUsername(), siteModel.getId()));
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
@@ -53,6 +54,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
.withCoreAPI()
.usingUser(new UserModel("invalidUser", "password")).addSiteMembershipRequest(siteModel);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
restClient.assertLastError().containsSummary("The entity with id: invalidUser was not found");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
@@ -63,6 +65,8 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
.withCoreAPI()
.usingMe().addSiteMembershipRequest(new SiteModel("invalidSiteID"));
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
restClient.assertLastError().containsSummary(String.format("The relationship resource was not found for" +
" the entity with id: %s and a relationship id of invalidSiteID", newMember.getUsername()));
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
@@ -56,6 +56,7 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
.getSitesMembershipInformation()
.assertThat().entriesListIsEmpty();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
restClient.assertLastError().containsSummary("The entity with id: invalidPersonId was not found");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
@@ -69,6 +70,37 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
.getSitesMembershipInformation()
.assertThat().entriesListIsEmpty();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
restClient.assertLastError().containsSummary("Only positive values supported for maxItems");
restClient.withParams("maxItems=-1")
.withCoreAPI()
.usingAuthUser()
.getSitesMembershipInformation()
.assertThat().entriesListIsEmpty();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
restClient.assertLastError().containsSummary("Only positive values supported for maxItems");
restClient.withParams("maxItems=test")
.withCoreAPI()
.usingAuthUser()
.getSitesMembershipInformation()
.assertThat().entriesListIsEmpty();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
restClient.assertLastError().containsSummary("Invalid paging parameter maxItems:test");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify if get site membership information request returns status code 200 for valid maxItems parameter")
public void getSiteMembershipInformationRequestReturns200ForValidMaxItemsParameter() throws Exception
{
restClient.authenticateUser(userModel)
.withParams("maxItems=5")
.withCoreAPI()
.usingAuthUser()
.getSitesMembershipInformation()
.assertThat().entriesListIsNotEmpty()
.getPagination().assertThat().field("maxItems").is("5");
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
@@ -82,6 +114,29 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
.getSitesMembershipInformation()
.assertThat().entriesListIsEmpty();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
restClient.assertLastError().containsSummary("Negative values not supported for skipCount");
restClient.withParams("skipCount=test")
.withCoreAPI()
.usingAuthUser()
.getSitesMembershipInformation()
.assertThat().entriesListIsEmpty();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
restClient.assertLastError().containsSummary("Invalid paging parameter skipCount:test");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify if get site membership information request returns status code 200 for valid skipCount parameter")
public void getSiteMembershipInformationRequestReturns200ForValidSkipCountParameter() throws Exception
{
restClient.authenticateUser(userModel)
.withParams("skipCount=1")
.withCoreAPI()
.usingAuthUser()
.getSitesMembershipInformation()
.assertThat().entriesListIsNotEmpty()
.getPagination().assertThat().field("skipCount").is("1");
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,