Search in sources :

Example 1 with ReportRequest

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);
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.report.response.ReportResponse) StudylogAbilityResponse(wooteco.prolog.report.application.dto.report.response.studylogs.StudylogAbilityResponse) GraphResponse(wooteco.prolog.report.application.dto.report.response.ability_graph.GraphResponse) ReportRequest(wooteco.prolog.report.application.dto.report.request.ReportRequest) GraphAbilityResponse(wooteco.prolog.report.application.dto.report.response.ability_graph.GraphAbilityResponse) StudylogResponse(wooteco.prolog.report.application.dto.report.response.studylogs.StudylogResponse) Then(io.cucumber.java.en.Then)

Example 2 with ReportRequest

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();
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.report.response.ReportResponse) ReportRequest(wooteco.prolog.report.application.dto.report.request.ReportRequest) Test(org.junit.jupiter.api.Test)

Example 3 with ReportRequest

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"));
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.report.response.ReportResponse) LoginMember(wooteco.prolog.login.ui.LoginMember) ReportRequest(wooteco.prolog.report.application.dto.report.request.ReportRequest) LoginMember(wooteco.prolog.login.ui.LoginMember) Member(wooteco.prolog.member.domain.Member) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with ReportRequest

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);
}
Also used : GraphRequest(wooteco.prolog.report.application.dto.report.request.abilitigraph.GraphRequest) ReportRequest(wooteco.prolog.report.application.dto.report.request.ReportRequest) ReportStudylogRequest(wooteco.prolog.report.application.dto.report.request.studylog.ReportStudylogRequest) AbilityRequest(wooteco.prolog.report.application.dto.report.request.abilitigraph.AbilityRequest) When(io.cucumber.java.en.When)

Example 5 with 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);
}
Also used : LoginMember(wooteco.prolog.login.ui.LoginMember) ReportRequest(wooteco.prolog.report.application.dto.report.request.ReportRequest) LoginMember(wooteco.prolog.login.ui.LoginMember) Member(wooteco.prolog.member.domain.Member) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ReportRequest (wooteco.prolog.report.application.dto.report.request.ReportRequest)7 Test (org.junit.jupiter.api.Test)5 ReportResponse (wooteco.prolog.report.application.dto.report.response.ReportResponse)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 LoginMember (wooteco.prolog.login.ui.LoginMember)3 Member (wooteco.prolog.member.domain.Member)3 Then (io.cucumber.java.en.Then)1 When (io.cucumber.java.en.When)1 AbilityRequest (wooteco.prolog.report.application.dto.report.request.abilitigraph.AbilityRequest)1 GraphRequest (wooteco.prolog.report.application.dto.report.request.abilitigraph.GraphRequest)1 ReportStudylogRequest (wooteco.prolog.report.application.dto.report.request.studylog.ReportStudylogRequest)1 GraphAbilityResponse (wooteco.prolog.report.application.dto.report.response.ability_graph.GraphAbilityResponse)1 GraphResponse (wooteco.prolog.report.application.dto.report.response.ability_graph.GraphResponse)1 StudylogAbilityResponse (wooteco.prolog.report.application.dto.report.response.studylogs.StudylogAbilityResponse)1 StudylogResponse (wooteco.prolog.report.application.dto.report.response.studylogs.StudylogResponse)1