added authentication step for admin tests

This commit is contained in:
cnechifor
2016-10-18 00:34:39 +03:00
parent 89d1151c7f
commit c4e3c6f684
6 changed files with 6 additions and 0 deletions
@@ -48,6 +48,7 @@ public class AddCommentSanityTests extends RestTest
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify admin user adds comments with Rest API and status code is 201")
public void adminIsAbleToAddComment() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
commentsAPI.addComment(document, "This is a new comment added by " + adminUserModel.getUsername());
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -58,6 +58,7 @@ public class AddCommentsSanityTests extends RestTest
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify admin user adds multiple comments with Rest API and status code is 201")
public void adminIsAbleToAddComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
commentsAPI.addComments(document, comment1, comment2);
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
}
@@ -61,6 +61,7 @@ public class DeleteCommentsSanityTests extends RestTest
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify Admin user delete comments with Rest API and status code is 204")
public void adminIsAbleToDeleteComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
commentsAPI.deleteComment(document, comment);
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT);
}
@@ -52,6 +52,7 @@ public class GetCommentsSanityTests extends RestTest
description= "Verify Admin user gets comments with Rest API and status code is 200")
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
commentsAPI.getNodeComments(document);
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}
@@ -53,6 +53,7 @@ public class UpdateCommentsSanityTests extends RestTest
TestGroup.COMMENTS }, executionType = ExecutionType.SANITY, description = "Verify Admin user updates comments and status code is 200")
public void adminIsAbleToUpdateComments() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
commentsAPI.updateComment(document, commentModel, "This is the updated comment with admin user");
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}
@@ -60,6 +60,7 @@ public class UpdateTagSanityTests extends RestTest
@Bug(id="MNT-16917")
public void adminIsAbleToUpdateTags() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUserModel);
tagsAPI.updateTag(oldTag, randomTag).assertTagIs(randomTag);
tagsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}