TAS-970 REST API - failed authentication for remove site member call returns status code 401

This commit is contained in:
Valentin Popa
2016-09-29 11:47:37 +03:00
parent e6cd9c7058
commit 98a784f2d2

View File

@@ -71,6 +71,21 @@ public class DeleteSiteMemberSanityTests extends RestTest
.assertStatusCodeIs(HttpStatus.NO_CONTENT.toString());
}
@TestRail(section = { "rest-api", "people" },
executionType = ExecutionType.SANITY,
description = "Verify admin user is able to delete another member of the site")
public void adminIsAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
newUser = dataUser.createRandomTestUser();
siteMember = new SiteMember(Role.SiteCollaborator.toString(), newUser.getUsername());
restClient.authenticateUser(adminUser);
sitesApi.addPerson(siteModel.getId(), siteMember);
peopleApi.deleteSiteMember(newUser.getUsername(), siteModel.getId());
sitesApi.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.NO_CONTENT.toString());
}
@TestRail(section = { "rest-api", "people" },
executionType = ExecutionType.SANITY,
description = "Verify site collaborator does not have permission to delete another member of the site")
@@ -121,17 +136,12 @@ public class DeleteSiteMemberSanityTests extends RestTest
@TestRail(section = { "rest-api", "people" },
executionType = ExecutionType.SANITY,
description = "Verify admin user is able to delete another member of the site")
public void adminIsAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
description = "Verify unauthenticated user is not able to delete another member of the site")
public void unauthenticatedUserIsNotAbleToDeleteSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
newUser = dataUser.createRandomTestUser();
siteMember = new SiteMember(Role.SiteCollaborator.toString(), newUser.getUsername());
restClient.authenticateUser(adminUser);
sitesApi.addPerson(siteModel.getId(), siteMember);
peopleApi.deleteSiteMember(newUser.getUsername(), siteModel.getId());
sitesApi.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.NO_CONTENT.toString());
}
restClient.authenticateUser(new UserModel("random user", "random password"));
peopleApi.deleteSiteMember(usersWithRoles.get(UserRole.SiteConsumer).getUsername(), siteModel.getId());
sitesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED.toString());
}
}