Search in sources :

Example 1 with TagRequest

use of wooteco.prolog.studylog.application.dto.TagRequest in project prolog by woowacourse.

the class TagDocumentation method 태그_목록을_조회한다.

@Test
void 태그_목록을_조회한다() {
    // given
    String title = "SPA";
    String content = "SPA 방식으로 앱을 구현하였음.\n" + "router 를 구현 하여 이용함.\n";
    Long sessionId = 세션_등록함(new SessionRequest("세션1"));
    Long missionId = 미션_등록함(new MissionRequest("세션1 - 지하철 노선도 미션", sessionId));
    List<TagRequest> tags = Arrays.asList(new TagRequest("자바"), new TagRequest("파이썬"));
    StudylogRequest studylogRequest = new StudylogRequest(title, content, missionId, tags);
    List<StudylogRequest> params = Arrays.asList(studylogRequest);
    RestAssured.given().header("Authorization", "Bearer " + 로그인_사용자.getAccessToken()).body(params).contentType(MediaType.APPLICATION_JSON_VALUE).when().post("/posts").then().log().all();
    // when
    ExtractableResponse<Response> response = given("tag/list").when().get("/tags").then().log().all().extract();
    // then
    List<TagResponse> tagResponses = response.jsonPath().getList(".", TagResponse.class);
    List<String> tagNames = tagResponses.stream().map(TagResponse::getName).collect(Collectors.toList());
    List<String> expectedNames = tags.stream().map(TagRequest::getName).collect(Collectors.toList());
    assertThat(tagNames).usingRecursiveComparison().isEqualTo(expectedNames);
}
Also used : TagResponse(wooteco.prolog.studylog.application.dto.TagResponse) SessionRequest(wooteco.prolog.session.application.dto.SessionRequest) MissionResponse(wooteco.prolog.session.application.dto.MissionResponse) SessionResponse(wooteco.prolog.session.application.dto.SessionResponse) TagResponse(wooteco.prolog.studylog.application.dto.TagResponse) ExtractableResponse(io.restassured.response.ExtractableResponse) Response(io.restassured.response.Response) MissionRequest(wooteco.prolog.session.application.dto.MissionRequest) TagRequest(wooteco.prolog.studylog.application.dto.TagRequest) StudylogRequest(wooteco.prolog.studylog.application.dto.StudylogRequest) Test(org.junit.jupiter.api.Test)

Example 2 with TagRequest

use of wooteco.prolog.studylog.application.dto.TagRequest in project prolog by woowacourse.

the class StudylogStepDefinitions method 세션과미션포함한스터디로그를작성하면.

// @Given("스터디로그를 작성하고")
// @When("스터디로그를 작성하면")
// public void 스터디로그를작성하면() {
// context.invokeHttpPostWithToken("/studylogs", STUDYLOG1.getStudylogRequest());
// }
@Given("스터디로그를 작성하고")
@When("스터디로그를 작성하면")
public void 세션과미션포함한스터디로그를작성하면() {
    StudylogRequest studylogRequest = new StudylogRequest("[자바][옵셔널] 학습log 제출합니다.", "옵셔널은 NPE를 배제하기 위해 만들어진 자바8에 추가된 라이브러리입니다. \n " + "다양한 메소드를 호출하여 원하는 대로 활용할 수 있습니다", 1L, 1L, Lists.newArrayList(new TagRequest(TAG1.getTagName()), new TagRequest(TAG2.getTagName())));
    context.invokeHttpPostWithToken("/studylogs", studylogRequest);
    if (context.response.statusCode() == HttpStatus.CREATED.value()) {
        context.storage.put("studylog", context.response.as(StudylogResponse.class));
    }
}
Also used : TagRequest(wooteco.prolog.studylog.application.dto.TagRequest) StudylogResponse(wooteco.prolog.studylog.application.dto.StudylogResponse) StudylogRequest(wooteco.prolog.studylog.application.dto.StudylogRequest) When(io.cucumber.java.en.When) Given(io.cucumber.java.en.Given)

Example 3 with TagRequest

use of wooteco.prolog.studylog.application.dto.TagRequest in project prolog by woowacourse.

the class MemberDocumentation method createStudylogRequest.

private List<StudylogRequest> createStudylogRequest(int size) {
    List<StudylogRequest> studylogRequests = new ArrayList<>();
    for (int i = 0; i < size; i++) {
        String title = "뭐라도 스터디로그가 있어야하니까";
        String content = "SPA 방식으로 앱을 구현하였음.\n" + "router 를 구현 하여 이용함.\n";
        Long sessionId = 세션_등록함(new SessionRequest("세션" + i));
        Long missionId = 미션_등록함(new MissionRequest(String.format("세션%d 미션", i), sessionId));
        List<TagRequest> tags = Arrays.asList(new TagRequest(String.format("%d번 태그", i)));
        studylogRequests.add(new StudylogRequest(title, content, missionId, tags));
    }
    return studylogRequests;
}
Also used : MissionRequest(wooteco.prolog.session.application.dto.MissionRequest) TagRequest(wooteco.prolog.studylog.application.dto.TagRequest) ArrayList(java.util.ArrayList) StudylogRequest(wooteco.prolog.studylog.application.dto.StudylogRequest) SessionRequest(wooteco.prolog.session.application.dto.SessionRequest)

Example 4 with TagRequest

use of wooteco.prolog.studylog.application.dto.TagRequest in project prolog by woowacourse.

the class StudylogRssFeedDocumentation method studylogRequest1.

private StudylogRequest studylogRequest1() {
    Long sessionId = 세션_등록함(new SessionRequest("세션 1"));
    Long missionId = 미션_등록함(new MissionRequest("세션 1 - 어떤 미션", sessionId));
    return new StudylogRequest("어떤 타이틀", "어떤 내용", missionId, Arrays.asList(new TagRequest("어떤 태그 1"), new TagRequest("어떤 태그 2")));
}
Also used : MissionRequest(wooteco.prolog.session.application.dto.MissionRequest) TagRequest(wooteco.prolog.studylog.application.dto.TagRequest) SessionRequest(wooteco.prolog.session.application.dto.SessionRequest) StudylogRequest(wooteco.prolog.studylog.application.dto.StudylogRequest)

Example 5 with TagRequest

use of wooteco.prolog.studylog.application.dto.TagRequest in project prolog by woowacourse.

the class StudylogRssFeedDocumentation method studylogRequest2.

private StudylogRequest studylogRequest2() {
    Long sessionId = 세션_등록함(new SessionRequest("세션 2"));
    Long missionId = 미션_등록함(new MissionRequest("세션 2 - 어쩌구 미션", sessionId));
    return new StudylogRequest("어쩌구 타이틀", "어쩌구 내용", missionId, Arrays.asList(new TagRequest("어쩌구 태그 1"), new TagRequest("어쩌구 태그 2")));
}
Also used : MissionRequest(wooteco.prolog.session.application.dto.MissionRequest) TagRequest(wooteco.prolog.studylog.application.dto.TagRequest) SessionRequest(wooteco.prolog.session.application.dto.SessionRequest) StudylogRequest(wooteco.prolog.studylog.application.dto.StudylogRequest)

Aggregations

TagRequest (wooteco.prolog.studylog.application.dto.TagRequest)13 StudylogRequest (wooteco.prolog.studylog.application.dto.StudylogRequest)11 MissionRequest (wooteco.prolog.session.application.dto.MissionRequest)9 SessionRequest (wooteco.prolog.session.application.dto.SessionRequest)9 Test (org.junit.jupiter.api.Test)4 StudylogResponse (wooteco.prolog.studylog.application.dto.StudylogResponse)3 When (io.cucumber.java.en.When)2 ExtractableResponse (io.restassured.response.ExtractableResponse)2 Response (io.restassured.response.Response)2 MissionResponse (wooteco.prolog.session.application.dto.MissionResponse)2 SessionResponse (wooteco.prolog.session.application.dto.SessionResponse)2 TagResponse (wooteco.prolog.studylog.application.dto.TagResponse)2 Given (io.cucumber.java.en.Given)1 ArrayList (java.util.ArrayList)1 DisplayName (org.junit.jupiter.api.DisplayName)1 LevelRequest (wooteco.prolog.studylog.application.dto.LevelRequest)1 MissionRequest (wooteco.prolog.studylog.application.dto.MissionRequest)1 StudylogsResponse (wooteco.prolog.studylog.application.dto.StudylogsResponse)1 IntegrationTest (wooteco.support.utils.IntegrationTest)1