use of wooteco.prolog.report.application.dto.report.request.ReportRequest in project prolog by woowacourse.
the class ReportStepDefinitions method 리포트가수정된다.
@Then("리포트가 수정된다")
public void 리포트가수정된다() {
int status = context.response.statusCode();
assertThat(status).isEqualTo(200);
ReportResponse reportResponse = context.response.as(ReportResponse.class);
ReportRequest reportRequest = (ReportRequest) context.storage.get("reportRequest");
ReportResponse expected = new ReportResponse(reportRequest.getId(), reportRequest.getTitle(), reportRequest.getDescription(), LocalDateTime.now(), LocalDateTime.now(), new GraphResponse(Arrays.asList(new GraphAbilityResponse(3L, "디자인", "blue", 2L, 1.0, true), new GraphAbilityResponse(1L, "프로그래밍", "red", 2L, 0.0, false))), Arrays.asList(new StudylogResponse(reportRequest.getStudylogs().get(0).getId(), LocalDateTime.now(), LocalDateTime.now(), "[자바][옵셔널] 학습log 제출합니다.", Arrays.asList(new StudylogAbilityResponse(3L, "디자인", "blue", true)))), true);
assertThat(reportResponse).usingRecursiveComparison().ignoringFields("studylogs.createAt", "studylogs.updateAt", "createdAt", "updatedAt").isEqualTo(expected);
}
use of wooteco.prolog.report.application.dto.report.request.ReportRequest in project prolog by woowacourse.
the class ReportDocumentation method 레포트를업데이트한다.
@Test
void 레포트를업데이트한다() {
final ReportResponse reportResponse = 리포트조회(1L);
final ReportRequest changedReport = 리포트변경(reportResponse);
given("reports/update").contentType(ContentType.JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + 로그인(GithubResponses.티케)).body(changedReport).when().put("/reports/{reportId}", 1).then().statusCode(HttpStatus.OK.value()).extract();
}
use of wooteco.prolog.report.application.dto.report.request.ReportRequest in project prolog by woowacourse.
the class ReportServiceTest method createReport.
@Test
void createReport() throws IOException {
Member member = createMember();
setAbilities(member);
setStudylogs(member);
ReportRequest reportRequest = createRequest("jsons/report_post_request.json");
ReportResponse reportResponse = reportService.createReport(reportRequest, new LoginMember(member.getId(), Authority.MEMBER));
assertThat(reportResponse).usingRecursiveComparison().ignoringFieldsMatchingRegexes(".*id", ".*updateAt", ".*createAt", ".*createdAt", ".*updatedAt").isEqualTo(expected("jsons/report_post_response.json"));
}
use of wooteco.prolog.report.application.dto.report.request.ReportRequest in project prolog by woowacourse.
the class ReportStepDefinitions method 대표리포트를등록.
@When("대표 리포트를 등록하(면)(고)")
public void 대표리포트를등록() {
ReportRequest reportRequest = new ReportRequest(null, "새로운 리포트" + reportCnt++, "리포트 설명", new GraphRequest(Arrays.asList(new AbilityRequest(1L, 1L, true))), Arrays.asList(new ReportStudylogRequest(1L, Arrays.asList(1L))), true);
context.invokeHttpPostWithToken("/reports", reportRequest);
}
use of wooteco.prolog.report.application.dto.report.request.ReportRequest in project prolog by woowacourse.
the class ReportServiceTest method createReport_duplicate_title.
@Test
void createReport_duplicate_title() throws IOException {
Member member = createMember();
setAbilities(member);
setStudylogs(member);
ReportRequest reportRequest = createRequest("jsons/report_post_request.json");
LoginMember loginMember = new LoginMember(member.getId(), Authority.MEMBER);
reportService.createReport(reportRequest, loginMember);
assertThatThrownBy(() -> reportService.createReport(reportRequest, loginMember)).isInstanceOf(DuplicateReportTitleException.class);
}
Aggregations