[test] 스터디 가입 요청/수락/거절 API 인수 테스트 추가#54
Open
crtEvent wants to merge 16 commits intofeat/#25-impl-join-request-3from
Open
[test] 스터디 가입 요청/수락/거절 API 인수 테스트 추가#54crtEvent wants to merge 16 commits intofeat/#25-impl-join-request-3from
crtEvent wants to merge 16 commits intofeat/#25-impl-join-request-3from
Conversation
- 스터디 가입 요청 - 스터디 가입 요청 수락 - 스터디 가입 요청 거절
crtEvent
commented
Apr 11, 2024
Comment on lines
+48
to
+56
| public SessionCookie 테스트_로그인(Long memberId) { | ||
| String sessionCookieValue = givenJsonRequest() | ||
| .body(memberId) | ||
| .when().post("/api/v1/test/sign-in") | ||
| .then().extract() | ||
| .cookie(sessionCookieName); | ||
|
|
||
| return new SessionCookie(sessionCookieName, sessionCookieValue); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
테스트용 로그인 메서드입니다. 로그인 하면 쿠키 객체를 반환합니다.
쿠키 객체는 Step 메서드에서 다음과 같이 사용합니다.
public static ExtractableResponse<Response> 스터디_가입_요청(Long studyId, SessionCookie sessionCookie) {
return givenJsonRequest()
.cookie(sessionCookie.name(), sessionCookie.value())
.when().post("/api/v1/studies/{studyId}/join-requests", studyId)
.then().log().all().extract();
}
Member
There was a problem hiding this comment.
테스트 로그인할 때 어드민 로그인으로 안하고 별도의 테스트 로그인을 만드신건가요?
Contributor
Author
There was a problem hiding this comment.
네, 테스트 시나리오 상 어드민이 아니라 다른 Member가 로그인 할 수도 있을 것 같아서 만들었어요
17 tasks
jinny-l
approved these changes
Apr 14, 2024
Comment on lines
25
to
29
|
|
||
| @BeforeEach | ||
| @BeforeAll | ||
| void setUp() { | ||
| RestAssured.port = port; | ||
| } |
Comment on lines
+12
to
+13
| public class JoinRequestFixture { | ||
|
|
Member
There was a problem hiding this comment.
흐음.. 에이프랑 저랑 사용하는 픽스쳐 형태가 달라서 fixture 를 어떻게 관리하면 좋을지 논의해보면 좋긴 할 것 같네요
Comment on lines
+46
to
+48
| var leader = memberRepository.save(리더()); | ||
| var member = memberRepository.save(멤버_01()); | ||
| var study = studyRepository.save(알고리즘_스터디()); |
Member
There was a problem hiding this comment.
저는 API 요청을 날렸는데 에이프는 레포지토리에 직접 저장하셨군요
Comment on lines
+114
to
+117
| private void 스터디_가입_요청이_생성되었는지_검증(ExtractableResponse<Response> response, Study study, Member member) { | ||
| var createdId = response.body().jsonPath().getLong("id"); | ||
| var created = joinRequestRepository.findById(createdId).get(); | ||
|
|
Member
There was a problem hiding this comment.
저는 actual expected 이런식으로 네이밍했어요!
Comment on lines
+48
to
+56
| public SessionCookie 테스트_로그인(Long memberId) { | ||
| String sessionCookieValue = givenJsonRequest() | ||
| .body(memberId) | ||
| .when().post("/api/v1/test/sign-in") | ||
| .then().extract() | ||
| .cookie(sessionCookieName); | ||
|
|
||
| return new SessionCookie(sessionCookieName, sessionCookieValue); | ||
| } |
Member
There was a problem hiding this comment.
테스트 로그인할 때 어드민 로그인으로 안하고 별도의 테스트 로그인을 만드신건가요?
Contributor
Author
|
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Key changes
👋 To reviewers
Redis Test Container 추가
테스트용 로그인 Step 메서드 구현
테스트 규칙 제안
API 마다 테스트 class 만들기
스터디 가입 요청 API->CreateJoinRequestTestFixture는 해당 도메인에서만 사용하기
테스트 케이스
스터디 가입 요청 케이스
스터디 가입 요청 수락 케이스
스터디 가입 요청 거절 케이스