Skip to content

Commit

Permalink
2024-11-11 - search and add-new external-recip
Browse files Browse the repository at this point in the history
  • Loading branch information
Luch76 committed Nov 11, 2024
1 parent 24629e1 commit 31037f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1170,32 +1170,6 @@ void testGetByCreatorRequesteeIdNotPermittedToRecipients() {
assertEquals(HttpStatus.OK, response.getStatus());
}

@Test
void testGetByCreatorRequesteeIdIsPermittedToExternalRecipients() {
//create two employee-PDL relationships
MemberProfile pdlMemberProfile = createADefaultMemberProfile();
assignPdlRole(pdlMemberProfile);
MemberProfile memberOne = createADefaultMemberProfileForPdl(pdlMemberProfile);
MemberProfile pdlMemberProfileTwo = createASecondDefaultMemberProfile();
assignPdlRole(pdlMemberProfileTwo);
MemberProfile memberTwo = createASecondDefaultMemberProfileForPdl(pdlMemberProfileTwo);
final FeedbackExternalRecipient externalRecipient01 = createADefaultFeedbackExternalRecipient();
final FeedbackExternalRecipient externalRecipient02 = createASecondDefaultFeedbackExternalRecipient();

//create two sample feedback requests by the same PDL
final FeedbackRequest feedbackReq = saveFeedbackRequest(pdlMemberProfile, memberOne, externalRecipient01);
saveFeedbackRequest(pdlMemberProfileTwo, memberTwo, externalRecipient02);

//search for feedback requests by a specific creator, requestee, and template
final HttpRequest<?> request = HttpRequest.GET(String.format("/?creatorId=%s&requesteeId=%s&externalRecipientId=%s", feedbackReq.getCreatorId(), feedbackReq.getRequesteeId(), feedbackReq.getExternalRecipientId()));
final HttpResponse<List<FeedbackRequestResponseDTO>> response = clientExternalRecipient.toBlocking()
.exchange(request, Argument.listOf(FeedbackRequestResponseDTO.class));

assertTrue(response.getBody().isPresent());
assertEquals(1, response.getBody().get().size());
assertEquals(HttpStatus.OK, response.getStatus());
}

@Test
void testGetByCreatorRecipientIdPermittedToRecipients() {
MemberProfile pdlMemberProfile = createADefaultMemberProfile();
Expand All @@ -1215,24 +1189,6 @@ void testGetByCreatorRecipientIdPermittedToRecipients() {
assertResponseEqualsEntity(feedbackRequest, response.getBody().get());
}

@Test
void testGetByCreatorRecipientIdPermittedToExternalRecipients() {
MemberProfile pdlMemberProfile = createADefaultMemberProfile();
assignPdlRole(pdlMemberProfile);
MemberProfile requestee = createADefaultMemberProfileForPdl(pdlMemberProfile);
final FeedbackExternalRecipient externalRecipient = createADefaultFeedbackExternalRecipient();
FeedbackRequest feedbackRequest = saveFeedbackRequest(pdlMemberProfile, requestee, externalRecipient);

//get feedback request
final HttpRequest<?> request = HttpRequest.GET(String.format("/?externalRecipientId=%s", feedbackRequest.getExternalRecipientId()));
final HttpResponse<FeedbackRequestResponseDTO> response = clientExternalRecipient.toBlocking().exchange(request, FeedbackRequestResponseDTO.class);

// recipient must be able to get the feedback request
assertEquals(HttpStatus.OK, response.getStatus());
assertTrue(response.getBody().isPresent());
assertResponseEqualsEntity(feedbackRequest, response.getBody().get());
}

@Test
void testGetByCreatorRequesteeIdMultiplePermittedToRecipients() {
//create two employee-PDL relationships
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default FeedbackExternalRecipient createADefaultFeedbackExternalRecipient() {
String companyName = "Company Name";

return getFeedbackExternalRecipientRepository().save(new FeedbackExternalRecipient(
email, firstName, lastName, companyName
email, firstName, lastName, companyName, null
));
}

Expand All @@ -26,7 +26,7 @@ default FeedbackExternalRecipient createASecondDefaultFeedbackExternalRecipient(
String companyName = "Company Name";

return getFeedbackExternalRecipientRepository().save(new FeedbackExternalRecipient(
email, firstName, lastName, companyName
email, firstName, lastName, companyName, null
));
}

Expand All @@ -37,7 +37,7 @@ default FeedbackExternalRecipient createAThirdDefaultFeedbackExternalRecipient()
String companyName = "Company Name";

return getFeedbackExternalRecipientRepository().save(new FeedbackExternalRecipient(
email, firstName, lastName, companyName
email, firstName, lastName, companyName, null
));
}

Expand Down

0 comments on commit 31037f1

Please sign in to comment.