added javaDoc, refactor usingNode to usingResource

This commit is contained in:
Paul Brodner
2016-11-16 10:48:36 +02:00
parent 199e313bed
commit 7ba600ec8f
8 changed files with 57 additions and 57 deletions
@@ -46,7 +46,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(adminUserModel);
String newContent = "This is a new comment added by " + adminUserModel.getUsername();
restClient.usingNode(document).addComment(newContent)
restClient.usingResource(document).addComment(newContent)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(newContent);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -57,7 +57,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
String contentSiteManger = "This is a new comment added by user with role: " + UserRole.SiteManager;
restClient.usingNode(document).addComment(contentSiteManger)
restClient.usingResource(document).addComment(contentSiteManger)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(contentSiteManger);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -68,7 +68,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
String contentSiteContributor = "This is a new comment added by user with role" + UserRole.SiteContributor;
restClient.usingNode(document).addComment(contentSiteContributor)
restClient.usingResource(document).addComment(contentSiteContributor)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(contentSiteContributor);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -79,7 +79,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
String contentSiteCollaborator = "This is a new comment added by user with role: " + UserRole.SiteCollaborator;
restClient.usingNode(document).addComment(contentSiteCollaborator)
restClient.usingResource(document).addComment(contentSiteCollaborator)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(contentSiteCollaborator);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -90,7 +90,7 @@ public class AddCommentSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
String contentSiteConsumer = "This is a new comment added by user with role: " + UserRole.SiteConsumer;
restClient.usingNode(document).addComment(contentSiteConsumer);
restClient.usingResource(document).addComment(contentSiteConsumer);
restClient
.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
@@ -101,7 +101,7 @@ public class AddCommentSanityTests extends RestTest
public void unauthenticatedUserIsNotAbleToAddComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"));
restClient.usingNode(document).addComment("This is a new comment");
restClient.usingResource(document).addComment("This is a new comment");
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -57,7 +57,7 @@ public class AddCommentsSanityTests extends RestTest
public void adminIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel)
.usingNode(document).addComments(comment1, comment2)
.usingResource(document).addComments(comment1, comment2)
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
@@ -69,7 +69,7 @@ public class AddCommentsSanityTests extends RestTest
public void managerIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.usingNode(document).addComments(comment1, comment2)
.usingResource(document).addComments(comment1, comment2)
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
@@ -81,7 +81,7 @@ public class AddCommentsSanityTests extends RestTest
public void contributorIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
.usingNode(document).addComments(comment1, comment2)
.usingResource(document).addComments(comment1, comment2)
.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
@@ -93,7 +93,7 @@ public class AddCommentsSanityTests extends RestTest
public void collaboratorIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingNode(document).addComments(comment1, comment2)
.usingResource(document).addComments(comment1, comment2)
.assertThat().paginationExist().and().entriesListIsNotEmpty()
.and().entriesListContains("content", comment1)
.and().entriesListContains("content", comment2);
@@ -106,7 +106,7 @@ public class AddCommentsSanityTests extends RestTest
public void consumerIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
.usingNode(document).addComments(comment1, comment2);
.usingResource(document).addComments(comment1, comment2);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -117,7 +117,7 @@ public class AddCommentsSanityTests extends RestTest
public void unauthenticatedUserIsNotAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(new UserModel("random user", "random password"))
.usingNode(document).addComments(comment1, comment2);
.usingResource(document).addComments(comment1, comment2);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -52,7 +52,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void addCommentToDocument() throws Exception
{
restClient.authenticateUser(adminUserModel);
comment = restClient.usingNode(document).addComment("This is a new comment");
comment = restClient.usingResource(document).addComment("This is a new comment");
}
@TestRail(section = { TestGroup.REST_API,
@@ -60,7 +60,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void adminIsAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
restClient.usingNode(document).deleteComment(comment);
restClient.usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@@ -69,7 +69,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void managerIsAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingNode(document).deleteComment(comment);
restClient.usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@@ -78,7 +78,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void collaboratorIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingNode(document).deleteComment(comment);
restClient.usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -88,7 +88,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void contributorIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingNode(document).deleteComment(comment);
restClient.usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -98,7 +98,7 @@ public class DeleteCommentsSanityTests extends RestTest
public void consumerIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingNode(document).deleteComment(comment);
restClient.usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -109,7 +109,7 @@ public class DeleteCommentsSanityTests extends RestTest
{
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
restClient.authenticateUser(nonexistentModel);
restClient.usingNode(document).deleteComment(comment);
restClient.usingResource(document).deleteComment(comment);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}
@@ -44,7 +44,7 @@ public class GetCommentsSanityTests extends RestTest
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
content = "This is a new comment";
restClient.usingNode(document).addComment(content);
restClient.usingResource(document).addComment(content);
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
}
@@ -54,7 +54,7 @@ public class GetCommentsSanityTests extends RestTest
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
restClient.usingNode(document).getNodeComments();
restClient.usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -63,7 +63,7 @@ public class GetCommentsSanityTests extends RestTest
public void managerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingNode(document).getNodeComments()
restClient.usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -74,7 +74,7 @@ public class GetCommentsSanityTests extends RestTest
public void contributorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
restClient.usingNode(document).getNodeComments()
restClient.usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -85,7 +85,7 @@ public class GetCommentsSanityTests extends RestTest
public void collaboratorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingNode(document).getNodeComments()
restClient.usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -95,7 +95,7 @@ public class GetCommentsSanityTests extends RestTest
public void consumerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingNode(document).getNodeComments()
restClient.usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", content);
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -107,7 +107,7 @@ public class GetCommentsSanityTests extends RestTest
{
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
restClient.authenticateUser(nonexistentModel);
restClient.usingNode(document).getNodeComments();
restClient.usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -118,10 +118,10 @@ public class GetCommentsSanityTests extends RestTest
userModel = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
restClient.authenticateUser(userModel);
String contentManager = "This is a new comment added by " + userModel.getUsername();
restClient.usingNode(document).addComment(contentManager);
restClient.usingResource(document).addComment(contentManager);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingNode(document).getNodeComments()
restClient.usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", contentManager);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -134,10 +134,10 @@ public class GetCommentsSanityTests extends RestTest
userModel = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
restClient.authenticateUser(userModel);
String contentCollaborator = "This is a new comment added by " + userModel.getUsername();
restClient.usingNode(document).addComment(contentCollaborator);
restClient.usingResource(document).addComment(contentCollaborator);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(adminUserModel);
restClient.usingNode(document).getNodeComments()
restClient.usingResource(document).getNodeComments()
.assertThat().entriesListContains("content", contentCollaborator);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -45,7 +45,7 @@ public class UpdateCommentsSanityTests extends RestTest
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
commentModel = restClient.usingNode(document).addComment("This is a new comment");
commentModel = restClient.usingResource(document).addComment("This is a new comment");
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
}
@@ -56,7 +56,7 @@ public class UpdateCommentsSanityTests extends RestTest
{
restClient.authenticateUser(adminUserModel);
String updatedContent = "This is the updated comment with admin user";
restClient.usingNode(document).updateComment(commentModel, updatedContent)
restClient.usingResource(document).updateComment(commentModel, updatedContent)
.assertThat().field("content").isNotEmpty()
.and().field("content").is(updatedContent);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -67,7 +67,7 @@ public class UpdateCommentsSanityTests extends RestTest
public void managerIsAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Manager user")
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Manager user")
.and().field("content").is("This is the updated comment with Manager user")
.and().field("canEdit").is(true)
.and().field("canDelete").is(true);
@@ -80,7 +80,7 @@ public class UpdateCommentsSanityTests extends RestTest
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
String updatedContent = "This is the updated comment with Contributor user";
restClient.usingNode(document).updateComment(commentModel, updatedContent);
restClient.usingResource(document).updateComment(commentModel, updatedContent);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -90,7 +90,7 @@ public class UpdateCommentsSanityTests extends RestTest
public void consumerIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Consumer user");
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Consumer user");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -101,7 +101,7 @@ public class UpdateCommentsSanityTests extends RestTest
public void collaboratorIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Collaborator user");
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user");
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
}
@@ -113,7 +113,7 @@ public class UpdateCommentsSanityTests extends RestTest
{
UserModel incorrectUserModel = new UserModel("userName", "password");
restClient.authenticateUser(incorrectUserModel)
.usingNode(document).getNodeComments();
.usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -124,7 +124,7 @@ public class UpdateCommentsSanityTests extends RestTest
FolderModel content = FolderModel.getRandomFolderModel();
content.setNodeRef("node ref that does not exist");
restClient.usingNode(content).updateComment(commentModel, "This is the updated comment.");
restClient.usingResource(content).updateComment(commentModel, "This is the updated comment.");
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary("node ref that does not exist was not found");
}
@@ -137,7 +137,7 @@ public class UpdateCommentsSanityTests extends RestTest
RestCommentModel comment = new RestCommentModel();
String id = "comment id that does not exist";
comment.setId(id);
restClient.usingNode(document).updateComment(comment, "This is the updated comment.");
restClient.usingResource(document).updateComment(comment, "This is the updated comment.");
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, id));
}
@@ -65,8 +65,8 @@ public class RestDemoTests extends RestTest
.usingResource(FolderModel.getSharedFolderModel())
.createContent(DocumentType.TEXT_PLAIN);
// add new comment
restClient.usingNode(fileModel).addComment("This is a new comment");
restClient.usingNode(fileModel).getNodeComments()
restClient.usingResource(fileModel).addComment("This is a new comment");
restClient.usingResource(fileModel).getNodeComments()
.assertThat().entriesListIsNotEmpty().and()
.entriesListContains("content", "This is a new comment");
}
@@ -36,7 +36,7 @@ public class SampleCommentsTests extends RestTest
description= "Verify admin user adds comments with Rest API and status code is 200")
public void admiShouldAddComment() throws JsonToModelConversionException, Exception
{
restClient.usingNode(document).addComment("This is a new comment");
restClient.usingResource(document).addComment("This is a new comment");
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -44,7 +44,7 @@ public class SampleCommentsTests extends RestTest
description= "Verify admin user gets comments with Rest API and status code is 200")
public void admiShouldRetrieveComments() throws Exception
{
restClient.usingNode(document).getNodeComments();
restClient.usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -52,9 +52,9 @@ public class SampleCommentsTests extends RestTest
description= "Verify admin user updates comments with Rest API")
public void adminShouldUpdateComment() throws JsonToModelConversionException, Exception
{
RestCommentModel commentModel = restClient.usingNode(document).addComment("This is a new comment");
RestCommentModel commentModel = restClient.usingResource(document).addComment("This is a new comment");
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Collaborator user")
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user")
.assertThat().field("content").is("This is the updated comment with Collaborator user");
}
@@ -54,7 +54,7 @@ public class AddRatingSanityTests extends RestTest
public void managerIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.usingNode(document).likeDocument();
.usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -67,7 +67,7 @@ public class AddRatingSanityTests extends RestTest
public void collaboratorIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
.usingNode(document).likeDocument();
.usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -79,7 +79,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Contributor role is able to post like rating to a document")
public void contributorIsAbleToLikeDocument() throws Exception
{
returnedRatingModel =restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingNode(document).likeDocument();
returnedRatingModel =restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -91,7 +91,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Consumer role is able to post like rating to a document")
public void consumerIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingNode(document).likeDocument();
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -103,7 +103,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to post like rating to a document")
public void adminIsAbleToLikeDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(adminUser).usingNode(document).likeDocument();
returnedRatingModel = restClient.authenticateUser(adminUser).usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("true")
@@ -116,7 +116,7 @@ public class AddRatingSanityTests extends RestTest
@Bug(id = "MNT-16904")
public void unauthenticatedUserIsNotAbleToLikeDocument() throws Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).usingNode(document).likeDocument();
restClient.authenticateUser(new UserModel("random user", "random password")).usingResource(document).likeDocument();
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
@@ -124,7 +124,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Manager role is able to post stars rating to a document")
public void managerIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingNode(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -135,7 +135,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Collaborator role is able to post stars rating to a document")
public void collaboratorIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingNode(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -147,7 +147,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Contributor role is able to post stars rating to a document")
public void contributorIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingNode(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -158,7 +158,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Consumer role is able to post stars rating to a document")
public void consumerIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingNode(document).rateStarsToDocument(5);
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is("5")
.and().field("id").is("fiveStar")
@@ -169,7 +169,7 @@ public class AddRatingSanityTests extends RestTest
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to post stars rating to a document")
public void adminIsAbleToAddStarsToDocument() throws Exception
{
returnedRatingModel = restClient.authenticateUser(adminUser).usingNode(document).rateStarsToDocument(3);
returnedRatingModel = restClient.authenticateUser(adminUser).usingResource(document).rateStarsToDocument(3);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
returnedRatingModel.assertThat().field("myRating").is(String.valueOf(3))
.and().field("id").is("fiveStar")
@@ -181,7 +181,7 @@ public class AddRatingSanityTests extends RestTest
@Bug(id = "MNT-16904")
public void unauthenticatedUserIsNotAbleToRateStarsToDocument() throws Exception
{
restClient.authenticateUser(new UserModel("random user", "random password")).usingNode(document).rateStarsToDocument(5);
restClient.authenticateUser(new UserModel("random user", "random password")).usingResource(document).rateStarsToDocument(5);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
}
}