Skip to content

Commit

Permalink
GRAD2-2817
Browse files Browse the repository at this point in the history
TVR Delete Process - Backend Changes Endpoints
  • Loading branch information
arybakov-cgi committed Aug 28, 2024
1 parent ca08576 commit 367a5ea
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ public void testGetStudentByPen_givenValues_returnsStudent_with_APICallSuccess()
assertThat(result).isNotNull();
assertThat(result.size()).isPositive();
assertThat(result.get(0).getPen()).isEqualTo(pen);

val result2 = this.restUtils.getStudentIDByPen(pen, "abc");
assertThat(result2).isNotNull();

}

@Test
Expand Down Expand Up @@ -1704,7 +1708,7 @@ public void testGetReportStudentIDsByStudentIDsAndReportType() {
};

when(this.webClient.post()).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradStudentReportsGuidsUrl(), "ACHV"))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradStudentReportsGuidsUrl(), "ACHV", 1))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.headers(any(Consumer.class))).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.contentType(any())).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.body(any(BodyInserter.class))).thenReturn(this.requestHeadersMock);
Expand All @@ -1729,7 +1733,7 @@ public void testGetReportStudentIDsByStudentIDsAndReportTypeError() {
};

when(this.webClient.post()).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradStudentReportsGuidsUrl(), "ACHV"))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradStudentReportsGuidsUrl(), "ACHV", 1))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.headers(any(Consumer.class))).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.contentType(any())).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.body(any(BodyInserter.class))).thenReturn(this.requestHeadersMock);
Expand Down Expand Up @@ -1941,14 +1945,15 @@ public void testArchiveStudents() {
mockTokenResponseObject();

when(this.webClient.post()).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradArchiveStudentsUrl(), 12345678L, "CUR"))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradArchiveStudentsUrl(), 12345678L, "CUR", "USER"))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.headers(any(Consumer.class))).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.contentType(any())).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.body(any(BodyInserter.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(Integer.class)).thenReturn(Mono.just(1));

DistributionSummaryDTO summaryDTO = new DistributionSummaryDTO();
summaryDTO.setUserName("USER");

val result = this.restUtils.archiveStudents(12345678L, schools,"CUR", summaryDTO);
assertThat(result).isEqualTo(1);
Expand All @@ -1961,14 +1966,15 @@ public void testArchiveStudentsError() {
mockTokenResponseObject();

when(this.webClient.post()).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradArchiveStudentsUrl(), 12345678L, "CUR"))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getGradArchiveStudentsUrl(), 12345678L, "CUR", "USER"))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.headers(any(Consumer.class))).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.contentType(any())).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.body(any(BodyInserter.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenThrow(new RuntimeException("Unable to archive Students"));
when(this.responseMock.bodyToMono(Integer.class)).thenReturn(Mono.just(0));

DistributionSummaryDTO summaryDTO = new DistributionSummaryDTO();
summaryDTO.setUserName("USER");

val result = this.restUtils.archiveStudents(12345678L, schools,"CUR", summaryDTO);
assertThat(result).isNotNull();
Expand Down

0 comments on commit 367a5ea

Please sign in to comment.