mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-10-01 14:41:19 +00:00
TAS-864 admin gets comment created by another user
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
package org.alfresco.rest;
|
package org.alfresco.rest.comments;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||||
|
import org.alfresco.rest.RestTest;
|
||||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||||
import org.alfresco.rest.requests.RestCommentsApi;
|
import org.alfresco.rest.requests.RestCommentsApi;
|
||||||
import org.alfresco.utility.data.DataUser;
|
import org.alfresco.utility.data.DataUser;
|
||||||
@@ -19,7 +20,7 @@ import org.testng.annotations.BeforeClass;
|
|||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@Test(groups = { "rest-api", "comments", "sanity" })
|
@Test(groups = { "rest-api", "comments", "sanity" })
|
||||||
public class GetCommentsTest extends RestTest
|
public class GetCommentsSanityTest extends RestTest
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
RestCommentsApi commentsAPI;
|
RestCommentsApi commentsAPI;
|
||||||
@@ -95,13 +96,10 @@ public class GetCommentsTest extends RestTest
|
|||||||
description= "Verify Manager user gets status code 401 if authentication call fails")
|
description= "Verify Manager user gets status code 401 if authentication call fails")
|
||||||
public void managerIsNotAbleToRetrieveCommentIfAuthenticationFails() throws JsonToModelConversionException, Exception
|
public void managerIsNotAbleToRetrieveCommentIfAuthenticationFails() throws JsonToModelConversionException, Exception
|
||||||
{
|
{
|
||||||
userModel = usersWithRoles.get(UserRole.SiteManager);
|
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
|
||||||
userModel.setPassword("incorrectPassword");
|
restClient.authenticateUser(nonexistentModel);
|
||||||
restClient.authenticateUser(userModel);
|
|
||||||
commentsAPI.getNodeComments(document.getNodeRef());
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
|
||||||
userModel.setPassword("password");
|
|
||||||
restClient.authenticateUser(userModel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
@@ -116,4 +114,17 @@ public class GetCommentsTest extends RestTest
|
|||||||
commentsAPI.getNodeComments(document.getNodeRef());
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY,
|
||||||
|
description= "Verify admin user gets comments created by another user and status code is 200")
|
||||||
|
public void adminIsAbleToRetrieveCommentsCreatedByAnotherUser() throws JsonToModelConversionException, Exception
|
||||||
|
{
|
||||||
|
userModel = usersWithRoles.get(UserRole.SiteCollaborator);
|
||||||
|
restClient.authenticateUser(userModel);
|
||||||
|
commentsAPI.addComment(document.getNodeRef(), "This is a new comment added by " + userModel.getUsername());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED.toString());
|
||||||
|
restClient.authenticateUser(adminUserModel);
|
||||||
|
commentsAPI.getNodeComments(document.getNodeRef());
|
||||||
|
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK.toString());
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user