Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error messages modified (https://github.com/gbif/registry/issues/565) #571

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public EntityOperationResponse allowedToCreateInstitution(
return new EntityOperationResponse(true);
} else {
return new EntityOperationResponse(
false, "Not allowed to create institutions for the country: " + country);
false, "Not allowed to create institutions for the country: " + (country == null ? "empty (Please provide a country with one of the addresses.)" : country));
}
}

Expand Down Expand Up @@ -287,9 +287,9 @@ public EntityOperationResponse allowedToCreateCollection(
return new EntityOperationResponse(
false,
"Not allowed to create collections under the institution: "
+ institutionKey
+ (institutionKey == null ? "empty" : institutionKey)
+ " or in the country: "
+ country);
+ (country == null ? "empty (Please provide a country with one of the addresses.)" : country));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,21 @@ public void collectionCreationAsMediatorAndCountryRightsTest() throws JsonProces
assertDoesNotThrow(() -> filter.doFilter(mockRequest, mockResponse, mockFilterChain));
}

@Test
public void collectionCreationAsMediatorTest() throws JsonProcessingException {
// GIVEN
mockCollectionCreation(ROLES_GRSCICOLL_MEDIATOR_ONLY, false, false);

// WHEN
WebApplicationException ex =
assertThrows(
WebApplicationException.class,
() -> filter.doFilter(mockRequest, mockResponse, mockFilterChain));

// THEN
assertEquals(HttpStatus.FORBIDDEN.value(), ex.getStatus());
}

@Test
public void institutionUpdateAsEditorWithEntityRightsTest() throws JsonProcessingException {
// GIVEN
Expand Down
Loading