test - updated tests from Core and Sanity

This commit is contained in:
mionescu
2017-01-10 15:52:38 +02:00
parent a8803c64b3
commit cc84692d33
2 changed files with 82 additions and 20 deletions
@@ -30,7 +30,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify user removes a site from favorites using '-me-' in place of personId with Rest API and response is successful (204)")
public void removeFavoriteSiteWithSuccessUsingMeAsPersonId() throws Exception
{
restClient.authenticateUser(adminUserModel);
@@ -42,7 +43,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@Bug(id = "REPO-1642", description = "reproduced on 5.2.1 only, it works on 5.2.0")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify inexistent user is not able to remove a site from favorites and response is 404")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify inexistent user is not able to remove a site from favorites and response is 404")
public void inexistentUserIsNotAbleToRemoveFavoriteSite() throws Exception
{
UserModel inexistentUser = new UserModel("inexistenUser", "password");
@@ -51,17 +53,24 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify user is not able to remove from favorites a site with inexistent id and response is 404")
public void userIsNotAbleToRemoveFavoriteSiteWithInexistentId() throws Exception
{
SiteModel inexistentSite = new SiteModel("inexistentSite");
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).removeFavoriteSite(inexistentSite);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, adminUserModel.getUsername(), inexistentSite.getTitle()));
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError()
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND,
adminUserModel.getUsername(), inexistentSite.getTitle()))
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE)
.containsErrorKey(RestErrorModel.RELATIONSHIP_NOT_FOUND_ERRORKEY);
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify manager user removes a site from its favorites and adds it again and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify manager user removes a site from its favorites and adds it again and response is successful (204)")
public void managerUserRemovesFavoriteSiteAndAddItAgain() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -75,7 +84,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
public void managerUserRemovesFavoriteSiteWithSuccess() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -88,7 +98,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify uninvited user can delete favorite public site and response is 204")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify uninvited user can delete favorite public site and response is 204")
public void uninvitedUserCanDeleteFavoritePublicSite() throws Exception
{
SiteModel publicSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
@@ -100,7 +111,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify uninvited user can delete favorite moderated site and response is 204")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify uninvited user can delete favorite moderated site and response is 204")
public void uninvitedUserCanDeleteFavoriteModeratedSite() throws Exception
{
SiteModel moderatedSiteModel = dataSite.usingUser(adminUserModel).createModeratedRandomSite();
@@ -112,7 +124,8 @@ public class DeleteFavoriteSiteCoreTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user can delete favorite private site and response is 204")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify user can delete favorite private site and response is 204")
public void userCanDeleteFavoritePrivateSite() throws Exception
{
SiteModel privateSiteModel = dataSite.usingUser(userModel).createPrivateRandomSite();
@@ -33,7 +33,8 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify manager user removes a site from its favorite sites list with Rest API and response is successful (204)")
public void managerUserRemovesFavoriteSiteWithSuccess() throws Exception
{
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -43,10 +44,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingAuthUser().getFavorites()
.assertThat()
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
.and().entriesListDoesNotContain("id", siteModel1.getId())
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify collaborator user removes a site from its favorite sites list with Rest API and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify collaborator user removes a site from its favorite sites list with Rest API and response is successful (204)")
public void collaboratorUserRemovesFavoriteSiteWithSuccess() throws Exception
{
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -56,10 +66,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingAuthUser().getFavorites()
.assertThat()
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
.and().entriesListDoesNotContain("id", siteModel1.getId())
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify contributor user removes a site from its favorite sites list with Rest API and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify contributor user removes a site from its favorite sites list with Rest API and response is successful (204)")
public void contributorUserRemovesFavoriteSiteWithSuccess() throws Exception
{
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
@@ -69,10 +88,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingAuthUser().getFavorites()
.assertThat()
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
.and().entriesListDoesNotContain("id", siteModel1.getId())
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify consumer user removes a site from its favorite sites list with Rest API and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify consumer user removes a site from its favorite sites list with Rest API and response is successful (204)")
public void consumerUserRemovesFavoriteSiteWithSuccess() throws Exception
{
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
@@ -82,10 +110,19 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingAuthUser().getFavorites()
.assertThat()
.entriesListDoesNotContain("targetGuid", siteModel1.getGuid())
.and().entriesListDoesNotContain("id", siteModel1.getId())
.and().entriesListDoesNotContain("description", siteModel1.getDescription())
.and().entriesListDoesNotContain("visibility", siteModel1.getVisibility().toString())
.and().entriesListDoesNotContain("title", siteModel1.getTitle());
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify admin user removes a site from any user's favorite sites list with Rest API and response is successful (204)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify admin user removes a site from any user's favorite sites list with Rest API and response is successful (204)")
public void adminUserRemovesAnyFavoriteSiteWithSuccess() throws Exception
{
UserModel adminUser = dataUser.getAdminUser();
@@ -98,8 +135,9 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify a user removes a site from another user's favorite sites list with Rest API and response is permission denied (403)")
public void userUserRemovesAnotherUserFavoriteSiteWithSuccess() throws Exception
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify a user removes a site from another user's favorite sites list with Rest API and response is permission denied (403)")
public void userRemovesAnotherUserFavoriteSiteWithSuccess() throws Exception
{
UserModel userAuth = dataUser.usingAdmin().createRandomTestUser();
UserModel anotherUser = dataUser.usingAdmin().createRandomTestUser();
@@ -107,11 +145,17 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
dataSite.usingUser(anotherUser).usingSite(siteModel2).addSiteToFavorites();
restClient.authenticateUser(userAuth).withCoreAPI().usingUser(anotherUser).removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
.assertLastError()
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE)
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY);
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)")
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.SANITY,
description = "Verify manager user is NOT Authorized to remove a site from its favorite sites list with Rest API when authentication fails (401)")
@Bug(id = "MNT-16904")
public void managerUserNotAuthorizedFailsToRemoveFavoriteSite() throws Exception
{
@@ -122,6 +166,11 @@ public class DeleteFavoriteSiteSanityTests extends RestTest
managerUser.setPassword("newpassword");
restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().removeFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastExceptionContains(HttpStatus.UNAUTHORIZED.toString());
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
.assertLastError()
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED)
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE)
.containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY);
}
}