mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
fixed NPEs, fixed tests
This commit is contained in:
@@ -101,8 +101,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
public void collaboratorIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
commentsAPI.updateComment(document, commentModel, "This is the updated comment with Collaborator user")
|
||||
.assertThat().field("content").is("This is the updated comment with Collaborator user");
|
||||
commentsAPI.updateComment(document, commentModel, "This is the updated comment with Collaborator user");
|
||||
|
||||
commentsAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
peopleApi.addSiteMembershipRequest(newMember, siteModel)
|
||||
.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("title").is(siteModel.getTitle());
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
peopleApi.usingRestWrapper()
|
||||
.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
peopleApi.addSiteMembershipRequest(newMember, siteModel)
|
||||
.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("title").is(siteModel.getTitle());
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
peopleApi.usingRestWrapper()
|
||||
.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
peopleApi.addSiteMembershipRequest(newMember, siteModel)
|
||||
.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("title").is(siteModel.getTitle());
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
peopleApi.usingRestWrapper()
|
||||
.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
peopleApi.addSiteMembershipRequest(newMember, siteModel)
|
||||
.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("title").is(siteModel.getTitle());
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
peopleApi.usingRestWrapper()
|
||||
.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
restClient.authenticateUser(adminUser);
|
||||
peopleApi.addSiteMembershipRequest(newMember, siteModel)
|
||||
.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("title").is(siteModel.getTitle());
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
peopleApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class AddSiteMembershipRequestSanityTests extends RestTest
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
peopleApi.addSiteMembershipRequest(newMember, siteModel)
|
||||
.assertThat().field("id").isNotEmpty()
|
||||
.assertThat().field("title").is(siteModel.getTitle());
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
peopleApi.usingRestWrapper()
|
||||
.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ public class GetSiteContainerSanityTests extends RestTest
|
||||
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteContainer() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
siteContainerModel = siteAPI.getSiteContainers(siteModel).getOneRandomEntry();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
userModel.setPassword("user wrong password");
|
||||
dataUser.addUserToSite(userModel, siteModel, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel);
|
||||
siteContainerModel = siteAPI.getSiteContainers(siteModel).getOneRandomEntry();
|
||||
siteAPI.getSiteContainer(siteModel, siteContainerModel);
|
||||
siteAPI.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@@ -8,10 +8,7 @@ import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
@@ -121,9 +118,9 @@ public class GetNodeTagsSanityTests extends RestTest
|
||||
public void unauthenticatedUserIsNotAbleToRetrieveNodeTags() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
tagsAPI.getNodeTags(document).assertThat().entriesListContains("tag", tagValue.toLowerCase());
|
||||
tagsAPI.getNodeTags(document);
|
||||
|
||||
tagsAPI.usingRestWrapper()
|
||||
.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
.assertStatusCodeIs(HttpStatus.UNAUTHORIZED).assertLastError().containsSummary(ErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user