-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add RestAssured dependency for E2E Test (#155)
* chore: add rest assured dependency * test(member): add E2E Test for member API * test(member): add E2E Test for member API * chore(test): add Database clean Up component * fix(exception): change exception parameter type * chore(test): add test data * chore(test): update RestAssured components * test(team): add team api REST test * fix(team): fix error * feat(meetingRequest): add find meetingRequest query * test(meetingRequest): test find meetingRequest query * fix(member): fix member response data * chore(rest): add support feature for RestAssured test * test(team): fix team read test * chore(rest): add COST to Deletion Exclusion list * test(meeting): add meeting API test
- Loading branch information
Showing
26 changed files
with
862 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/test/java/com/e2i/wemeet/rest/MeetingControllerRestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.e2i.wemeet.rest; | ||
|
||
import static com.e2i.wemeet.rest.support.RestAssuredRequestUtils.로그인된_상태로_POST_요청을_보낸다; | ||
import static com.e2i.wemeet.security.token.JwtEnv.ACCESS; | ||
import static com.e2i.wemeet.support.fixture.MemberFixture.KAI; | ||
import static com.e2i.wemeet.support.fixture.MemberFixture.KARINA; | ||
import static com.e2i.wemeet.support.fixture.RestAssuredFixture.카이; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.tuple; | ||
|
||
import com.e2i.wemeet.domain.meeting.MeetingRepository; | ||
import com.e2i.wemeet.domain.meeting.MeetingRequest; | ||
import com.e2i.wemeet.domain.meeting.MeetingRequestRepository; | ||
import com.e2i.wemeet.dto.request.meeting.SendMeetingRequestDto; | ||
import com.e2i.wemeet.dto.response.meeting.AcceptedMeetingResponseDto; | ||
import com.e2i.wemeet.rest.support.MultipartRequest; | ||
import com.e2i.wemeet.support.module.AbstractAcceptanceTest; | ||
import io.restassured.response.ExtractableResponse; | ||
import io.restassured.response.Response; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
class MeetingControllerRestTest extends AbstractAcceptanceTest { | ||
|
||
@Autowired | ||
private MeetingRequestRepository meetingRequestRepository; | ||
|
||
@Autowired | ||
private MeetingRepository meetingRepository; | ||
|
||
@DisplayName("회원가입, 사진 등록 후 팀을 생성하고 미팅을 신청할 수 있다.") | ||
@Test | ||
void meetingRequest() throws IOException { | ||
// given | ||
MultipartRequest<Object> images = createMultiPartRequest( | ||
"images", "classpath:/static/test_image/software maestro.png"); | ||
|
||
final Long womanTeamId = 여자_4인팀을_생성한다(KARINA.create(WOMANS_CODE)).team().getTeamId(); | ||
String accessToken = 카이.회원가입하고_1번_팀을_생성한다(images).header(ACCESS.getKey()); | ||
|
||
SendMeetingRequestDto requestDto = new SendMeetingRequestDto(womanTeamId); | ||
|
||
// when | ||
final String url = "/v1/meeting"; | ||
ExtractableResponse<Response> response = 로그인된_상태로_POST_요청을_보낸다(url, accessToken, requestDto); | ||
|
||
// then | ||
assertThat(response.statusCode()).isEqualTo(200); | ||
} | ||
|
||
@DisplayName("미팅 신청 목록에서 ID를 확인한 뒤 수락할 수 있다.") | ||
@Test | ||
void requestAndAccept() { | ||
// given | ||
CreationData womanData = 여자_4인팀을_생성한다(KARINA.create(WOMANS_CODE)); | ||
CreationData manData = 남자_4인팀을_생성한다(KAI.create(ANYANG_CODE)); | ||
|
||
미팅을_신청한다(manData, womanData); | ||
SendMeetingRequestDto meetingRequest = new SendMeetingRequestDto(womanData.team().getTeamId()); | ||
|
||
// when | ||
List<MeetingRequest> findRequest = meetingRequestRepository.findAllByMemberId(womanData.member().getMemberId()); | ||
ExtractableResponse<Response> response = 로그인된_상태로_POST_요청을_보낸다( | ||
"/v1/meeting/accept/" + findRequest.get(0).getMeetingRequestId(), womanData.accessToken(), meetingRequest); | ||
|
||
// then | ||
List<AcceptedMeetingResponseDto> acceptedMeetingList = meetingRepository.findAcceptedMeetingList(womanData.member().getMemberId()); | ||
long meetingId = response.body().jsonPath().getLong("data"); | ||
|
||
assertThat(response.statusCode()).isEqualTo(200); | ||
assertThat(acceptedMeetingList).hasSize(1) | ||
.extracting("meetingId", "teamId") | ||
.contains( | ||
tuple(meetingId, manData.team().getTeamId()) | ||
); | ||
} | ||
|
||
private MeetingRequest 미팅을_신청한다(CreationData manData, CreationData womanData) { | ||
return meetingRequestRepository.save(MeetingRequest.builder() | ||
.team(manData.team()) | ||
.partnerTeam(womanData.team()) | ||
.build()); | ||
} | ||
|
||
} |
Oops, something went wrong.