From 7208d4963efff33e6926ab1be87e47eec0ea997f Mon Sep 17 00:00:00 2001 From: Adina Parpalita Date: Mon, 2 Nov 2020 13:19:44 +0200 Subject: [PATCH] - fix a few rest-api [tas] tests according with some recent changes from tas-utility --- .../rest/comments/GetCommentsTests.java | 4 +-- .../rest/people/GetPeopleSanityTests.java | 30 ++++++++++++------- .../GetPeopleActivitiesFullTests.java | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/comments/GetCommentsTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/comments/GetCommentsTests.java index 5872f83a7f..dddd046ccb 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/comments/GetCommentsTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/comments/GetCommentsTests.java @@ -317,7 +317,7 @@ public class GetCommentsTests extends RestTest restClient.authenticateUser(user1).withCoreAPI().usingResource(file).addComment(comment); comments = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).getNodeComments(); - comments.getOneRandomEntry().onModel().getCreatedBy().assertThat().field("firstName").is(user1.getUsername() + " FirstName") + comments.getOneRandomEntry().onModel().getCreatedBy().assertThat().field("firstName").is("FN-" + user1.getUsername()) .assertThat().field("lastName").is("LN-" + user1.getUsername()); } @@ -393,7 +393,7 @@ public class GetCommentsTests extends RestTest comments.assertThat().paginationField("totalItems").is("2"); comments.getEntries().get(0).onModel().getCreatedBy() - .assertThat().field("firstName").is(usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername() + " FirstName") + .assertThat().field("firstName").is("FN-" + usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername()) .assertThat().field("lastName").is("LN-" + usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername()); comments.getEntries().get(1).onModel().getCreatedBy() diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleSanityTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleSanityTests.java index 2678895a52..f6bff2aaea 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleSanityTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleSanityTests.java @@ -41,8 +41,10 @@ public class GetPeopleSanityTests extends RestTest personModel = restClient.authenticateUser(managerUser).withCoreAPI().usingUser(searchedUser).getPerson(); restClient.assertStatusCodeIs(HttpStatus.OK); - personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and() - .field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true"); + personModel.assertThat().field("id").is(searchedUser.getUsername()) + .and().field("firstName").is("FN-" + searchedUser.getUsername()) + .and().field("email").is(searchedUser.getUsername() + domain) + .and().field("emailNotificationsEnabled").is("true"); } @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY }) @@ -54,8 +56,10 @@ public class GetPeopleSanityTests extends RestTest personModel = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingUser(searchedUser).getPerson(); restClient.assertStatusCodeIs(HttpStatus.OK); - personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and() - .field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true"); + personModel.assertThat().field("id").is(searchedUser.getUsername()) + .and().field("firstName").is("FN-" + searchedUser.getUsername()) + .and().field("email").is(searchedUser.getUsername() + domain) + .and().field("emailNotificationsEnabled").is("true"); } @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.COMMENTS, TestGroup.SANITY }) @@ -67,8 +71,10 @@ public class GetPeopleSanityTests extends RestTest personModel = restClient.authenticateUser(contributorUser).withCoreAPI().usingUser(searchedUser).getPerson(); restClient.assertStatusCodeIs(HttpStatus.OK); - personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and() - .field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true"); + personModel.assertThat().field("id").is(searchedUser.getUsername()) + .and().field("firstName").is("FN-" + searchedUser.getUsername()) + .and().field("email").is(searchedUser.getUsername() + domain) + .and().field("emailNotificationsEnabled").is("true"); } @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY }) @@ -80,8 +86,10 @@ public class GetPeopleSanityTests extends RestTest personModel = restClient.authenticateUser(consumerUser).withCoreAPI().usingUser(searchedUser).getPerson(); restClient.assertStatusCodeIs(HttpStatus.OK); - personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and() - .field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true"); + personModel.assertThat().field("id").is(searchedUser.getUsername()) + .and().field("firstName").is("FN-" + searchedUser.getUsername()) + .and().field("email").is(searchedUser.getUsername() + domain) + .and().field("emailNotificationsEnabled").is("true"); ; } @@ -91,8 +99,10 @@ public class GetPeopleSanityTests extends RestTest { personModel = restClient.authenticateUser(adminUser).withCoreAPI().usingUser(searchedUser).getPerson(); restClient.assertStatusCodeIs(HttpStatus.OK); - personModel.assertThat().field("id").is(searchedUser.getUsername()).assertThat().field("firstName").is(searchedUser.getUsername() + " FirstName").and() - .field("email").is(searchedUser.getUsername() + domain).and().field("emailNotificationsEnabled").is("true"); + personModel.assertThat().field("id").is(searchedUser.getUsername()) + .and().field("firstName").is("FN-" + searchedUser.getUsername()) + .and().field("email").is(searchedUser.getUsername() + domain) + .and().field("emailNotificationsEnabled").is("true"); ; } diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/activities/GetPeopleActivitiesFullTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/activities/GetPeopleActivitiesFullTests.java index d15bec3a6d..05afb96b2b 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/activities/GetPeopleActivitiesFullTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/activities/GetPeopleActivitiesFullTests.java @@ -63,7 +63,7 @@ public class GetPeopleActivitiesFullTests extends RestTest // after repo-4250 a file is created first and then update it with content, so there are more entries than previously restActivityModelsCollection.assertThat().paginationField("count").is("2"); RestActivitySummaryModel summary = restActivityModelsCollection.getEntries().get(0).onModel().getActivitySummary(); - summary.assertThat().field("firstName").is(userModel.getUsername() + " FirstName") + summary.assertThat().field("firstName").is("FN-" + userModel.getUsername()) .and().field("lastName").is("LN-" + userModel.getUsername()) .and().field("title").is(fileInSite1.getName()) .and().field("objectId").is(fileInSite1.getNodeRefWithoutVersion());