From fbdda1c6a8029d59960b9477d04903b2d909c76c Mon Sep 17 00:00:00 2001 From: Cristina Axinte Date: Tue, 10 Jan 2017 15:59:37 +0200 Subject: [PATCH] TAS-2626, TAS-2627, TAS-2628 added new full tests and method to assed field is not present in entries --- .../people/GetPeopleActivitiesFullTests.java | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesFullTests.java b/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesFullTests.java index 5e01bb755..8950cd654 100644 --- a/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesFullTests.java +++ b/e2e-test/java/org/alfresco/rest/people/GetPeopleActivitiesFullTests.java @@ -146,11 +146,55 @@ public class GetPeopleActivitiesFullTests extends RestTest } @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.FULL }) - @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user cannot get activities for another user with Rest API and response is successful") + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user cannot get activities for another user with Rest API and response is permission denied") public void userGetPeopleActivitiesForAnotherUser() throws Exception { restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingUser(managerUser).getPersonActivities(); restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN); restClient.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED); } + + @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.FULL }) + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities with properties parameter applied with Rest API and response is successful") + public void userGetPeopleActivitiesUsingPropertiesParameter() throws Exception + { + restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("properties=postPersonId").getPersonActivities(); + restClient.assertStatusCodeIs(HttpStatus.OK); + restActivityModelsCollection.assertThat().paginationField("count").is("4"); + restActivityModelsCollection.assertThat().entriesListContains("postPersonId", userModel.getUsername().toLowerCase()) + .and().entriesListContains("postPersonId", adminUser.getUsername().toLowerCase()) + .and().entriesListContains("postPersonId", managerUser.getUsername().toLowerCase()) + .and().entriesListDoesNotContain("postedAt") + .and().entriesListDoesNotContain("feedPersonId") + .and().entriesListDoesNotContain("siteId") + .and().entriesListDoesNotContain("activitySummary") + .and().entriesListDoesNotContain("id") + .and().entriesListDoesNotContain("activityType"); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.FULL }) + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities with skipCount parameter applied with Rest API and response is successful") + public void userGetPeopleActivitiesUsingSkipCountParameter() throws Exception + { + restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("skipCount=2").getPersonActivities(); + restClient.assertStatusCodeIs(HttpStatus.OK); + restActivityModelsCollection.assertThat().paginationField("count").is("2"); + restActivityModelsCollection.getEntries().get(0).onModel().assertThat().field("postPersonId").is(userModel.getUsername().toLowerCase()) + .and().field("activityType").is(ActivityType.FOLDER_ADDED.toString()); + restActivityModelsCollection.getEntries().get(1).onModel().assertThat().field("postPersonId").is(userModel.getUsername().toLowerCase()) + .and().field("activityType").is(ActivityType.FILE_ADDED.toString()); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.FULL }) + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES }, executionType = ExecutionType.REGRESSION, description = "Verify user gets activities with maxItems parameter applied with Rest API and response is successful") + public void userGetPeopleActivitiesUsingMaxItemsParameter() throws Exception + { + restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingMe().usingParams("maxItems=2").getPersonActivities(); + restClient.assertStatusCodeIs(HttpStatus.OK); + restActivityModelsCollection.assertThat().paginationField("count").is("2"); + restActivityModelsCollection.getEntries().get(0).onModel().assertThat().field("postPersonId").is(managerUser.getUsername().toLowerCase()) + .and().field("activityType").is(ActivityType.USER_JOINED.toString()); + restActivityModelsCollection.getEntries().get(1).onModel().assertThat().field("postPersonId").is(adminUser.getUsername().toLowerCase()) + .and().field("activityType").is(ActivityType.FILE_ADDED.toString()); + } }