Skip to content

Commit

Permalink
fix: 테스트 코드 수정 사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
kimyu0218 committed Nov 21, 2024
1 parent a4139c6 commit adce1a5
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.nexters.goalpanzi.acceptance;

import com.nexters.goalpanzi.application.auth.dto.request.GoogleLoginCommand;
import com.nexters.goalpanzi.domain.mission.DayOfWeek;
import com.nexters.goalpanzi.domain.mission.TimeOfDay;
import com.nexters.goalpanzi.presentation.auth.dto.GoogleLoginRequest;
import com.nexters.goalpanzi.presentation.member.dto.UpdateProfileRequest;
import com.nexters.goalpanzi.presentation.mission.dto.CreateMissionRequest;
import com.nexters.goalpanzi.presentation.mission.dto.JoinMissionRequest;
Expand All @@ -24,7 +24,7 @@

public class AcceptanceStep {

public static ExtractableResponse<Response> 구글_로그인(GoogleLoginCommand request) {
public static ExtractableResponse<Response> 구글_로그인(GoogleLoginRequest request) {
return RestAssured.given().log().all()
.contentType(MediaType.APPLICATION_JSON_VALUE)
.body(request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.nexters.goalpanzi.application.auth.SocialUserInfo;
import com.nexters.goalpanzi.application.auth.SocialUserProvider;
import com.nexters.goalpanzi.application.auth.SocialUserProviderFactory;
import com.nexters.goalpanzi.application.auth.dto.request.AppleLoginCommand;
import com.nexters.goalpanzi.application.auth.dto.request.GoogleLoginCommand;
import com.nexters.goalpanzi.application.auth.dto.response.LoginResponse;
import com.nexters.goalpanzi.fixture.TokenFixture;
import com.nexters.goalpanzi.presentation.auth.dto.AppleLoginRequest;
import com.nexters.goalpanzi.presentation.auth.dto.GoogleLoginRequest;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
Expand All @@ -18,7 +18,6 @@

import static com.nexters.goalpanzi.acceptance.AcceptanceStep.구글_로그인;
import static com.nexters.goalpanzi.acceptance.AcceptanceStep.회원_탈퇴;
import static com.nexters.goalpanzi.fixture.MemberFixture.DEVICE_TOKEN;
import static com.nexters.goalpanzi.fixture.MemberFixture.EMAIL_HOST;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;
Expand All @@ -36,7 +35,7 @@ public class LoginAcceptanceTest extends AcceptanceTest {
@Test
void 사용자가_애플_로그인을_정상적으로_한다() throws NoSuchAlgorithmException {
String appleToken = TokenFixture.generateAppleToken();
AppleLoginCommand request = new AppleLoginCommand(appleToken, DEVICE_TOKEN);
AppleLoginRequest request = new AppleLoginRequest(appleToken);

when(socialUserProviderFactory.getProvider(any()))
.thenReturn(socialUserProvider);
Expand All @@ -61,7 +60,7 @@ public class LoginAcceptanceTest extends AcceptanceTest {

@Test
void 사용자가_구글_로그인을_정상적으로_한다() {
GoogleLoginCommand request = new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN);
GoogleLoginRequest request = new GoogleLoginRequest(EMAIL_HOST);

LoginResponse actual = RestAssured.given().log().all()
.contentType(MediaType.APPLICATION_JSON_VALUE)
Expand All @@ -81,10 +80,10 @@ public class LoginAcceptanceTest extends AcceptanceTest {

@Test
void 사용자가_탈퇴후_입한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
회원_탈퇴(login.memberId(), login.accessToken());
LoginResponse actual = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);

LoginResponse actual = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);

assertThat(actual.memberId()).isNotNull();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.nexters.goalpanzi.acceptance;

import com.nexters.goalpanzi.application.auth.dto.request.GoogleLoginCommand;
import com.nexters.goalpanzi.application.auth.dto.response.LoginResponse;
import com.nexters.goalpanzi.application.member.dto.response.ProfileResponse;
import com.nexters.goalpanzi.application.mission.dto.response.MissionDetailResponse;
import com.nexters.goalpanzi.domain.member.Member;
import com.nexters.goalpanzi.domain.member.repository.MemberRepository;
import com.nexters.goalpanzi.presentation.auth.dto.GoogleLoginRequest;
import com.nexters.goalpanzi.presentation.member.dto.UpdateProfileRequest;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
Expand All @@ -27,7 +27,7 @@ public class MemberAcceptanceTest extends AcceptanceTest {

@Test
void 프로필을_설정한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
프로필_설정(new UpdateProfileRequest(NICKNAME_HOST, CHARACTER_HOST), login.accessToken());

Member actual = memberRepository.getMember(login.memberId());
Expand All @@ -39,7 +39,7 @@ public class MemberAcceptanceTest extends AcceptanceTest {

@Test
void 프로필을_조회한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
프로필_설정(new UpdateProfileRequest(NICKNAME_HOST, CHARACTER_HOST), login.accessToken());

ProfileResponse actual = RestAssured.given().log().all()
Expand All @@ -59,7 +59,7 @@ public class MemberAcceptanceTest extends AcceptanceTest {

@Test
void 회원이_탈퇴한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
MissionDetailResponse mission = 미션_생성(login.accessToken()).as(MissionDetailResponse.class);

RestAssured.given().log().all()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.nexters.goalpanzi.acceptance;

import com.nexters.goalpanzi.application.auth.dto.request.GoogleLoginCommand;
import com.nexters.goalpanzi.application.auth.dto.response.LoginResponse;
import com.nexters.goalpanzi.application.mission.dto.response.MissionDetailResponse;
import com.nexters.goalpanzi.domain.mission.DayOfWeek;
import com.nexters.goalpanzi.domain.mission.TimeOfDay;
import com.nexters.goalpanzi.domain.mission.repository.MissionMemberRepository;
import com.nexters.goalpanzi.domain.mission.repository.MissionRepository;
import com.nexters.goalpanzi.presentation.auth.dto.GoogleLoginRequest;
import com.nexters.goalpanzi.presentation.mission.dto.CreateMissionRequest;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
Expand All @@ -19,7 +19,6 @@
import java.util.List;

import static com.nexters.goalpanzi.acceptance.AcceptanceStep.*;
import static com.nexters.goalpanzi.fixture.MemberFixture.DEVICE_TOKEN;
import static com.nexters.goalpanzi.fixture.MemberFixture.EMAIL_HOST;
import static com.nexters.goalpanzi.fixture.MissionFixture.DESCRIPTION;
import static com.nexters.goalpanzi.fixture.TokenFixture.BEARER;
Expand All @@ -36,7 +35,7 @@ public class MissionAcceptanceTest extends AcceptanceTest {

@Test
void 미션을_생성한다() {
LoginResponse loginResponse = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse loginResponse = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);

CreateMissionRequest request = new CreateMissionRequest(DESCRIPTION, LocalDateTime.now().plusDays(1), LocalDateTime.now().plusDays(5), TimeOfDay.EVERYDAY, List.of(DayOfWeek.FRIDAY), 5);

Expand All @@ -50,7 +49,7 @@ public class MissionAcceptanceTest extends AcceptanceTest {

@Test
void 미션을_조회한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);

CreateMissionRequest request = new CreateMissionRequest(DESCRIPTION, LocalDateTime.now().plusDays(1),
LocalDateTime.now().plusDays(5), TimeOfDay.EVERYDAY,
Expand All @@ -69,7 +68,7 @@ public class MissionAcceptanceTest extends AcceptanceTest {

@Test
void 초대코드로_미션을_조회한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);

CreateMissionRequest request = new CreateMissionRequest(DESCRIPTION, LocalDateTime.now().plusDays(1),
LocalDateTime.now().plusDays(5), TimeOfDay.EVERYDAY,
Expand All @@ -94,7 +93,7 @@ public class MissionAcceptanceTest extends AcceptanceTest {

@Test
void 미션을_생성한_사용자는_자동으로_경쟁에_된다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);

CreateMissionRequest request = new CreateMissionRequest(DESCRIPTION, LocalDateTime.now().plusDays(1),
LocalDateTime.now().plusDays(5), TimeOfDay.EVERYDAY,
Expand All @@ -108,7 +107,7 @@ public class MissionAcceptanceTest extends AcceptanceTest {

@Test
void 미션을_삭제한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
MissionDetailResponse mission = 미션_생성(login.accessToken()).as(MissionDetailResponse.class);

RestAssured.given().log().all()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//package com.nexters.goalpanzi.acceptance;
//
//import com.nexters.goalpanzi.application.auth.dto.request.GoogleLoginCommand;
//import com.nexters.goalpanzi.presentation.auth.dto.GoogleLoginRequest;
//import com.nexters.goalpanzi.application.auth.dto.response.LoginResponse;
//import com.nexters.goalpanzi.application.mission.dto.response.MissionBoardsResponse;
//import com.nexters.goalpanzi.application.mission.dto.response.MissionDetailResponse;
Expand Down Expand Up @@ -31,17 +31,17 @@
// void 보드판_정보를_조회한다() {
// when(objectStorageClient.uploadFile(any(MultipartFile.class))).thenReturn(UPLOADED_IMAGE_URL);
//
// LoginResponse hostLogin = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
// LoginResponse hostLogin = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
// 프로필_설정(new UpdateProfileRequest(NICKNAME_HOST, CHARACTER_HOST), hostLogin.accessToken());
// MissionDetailResponse mission = 미션_생성(hostLogin.accessToken()).as(MissionDetailResponse.class);
// 미션_인증(IMAGE_FILE, mission.missionId(), hostLogin.accessToken());
//
// LoginResponse memberALogin = 구글_로그인(new GoogleLoginCommand(EMAIL_MEMBER_A, DEVICE_TOKEN)).as(LoginResponse.class);
// LoginResponse memberALogin = 구글_로그인(new GoogleLoginRequest(EMAIL_MEMBER_A)).as(LoginResponse.class);
// 프로필_설정(new UpdateProfileRequest(NICKNAME_MEMBER_A, CHARACTER_MEMBER_A), memberALogin.accessToken());
// 미션_참여(mission.invitationCode(), memberALogin.accessToken());
// 미션_인증(IMAGE_FILE, mission.missionId(), memberALogin.accessToken());
//
// LoginResponse memberBLogin = 구글_로그인(new GoogleLoginCommand(EMAIL_MEMBER_B, DEVICE_TOKEN)).as(LoginResponse.class);
// LoginResponse memberBLogin = 구글_로그인(new GoogleLoginRequest(EMAIL_MEMBER_B)).as(LoginResponse.class);
// 프로필_설정(new UpdateProfileRequest(NICKNAME_MEMBER_B, CHARACTER_MEMBER_B), memberBLogin.accessToken());
// 미션_참여(mission.invitationCode(), memberBLogin.accessToken());
//
Expand Down Expand Up @@ -69,12 +69,12 @@
//// void 내가_참여하지_않은_미션의_보드판을_조회할_수_없다() {
//// when(objectStorageClient.uploadFile(any(MultipartFile.class))).thenReturn(UPLOADED_IMAGE_URL);
////
//// LoginResponse memberALogin = 구글_로그인(new GoogleLoginCommand(EMAIL_MEMBER_A, DEVICE_TOKEN)).as(LoginResponse.class);
//// LoginResponse memberALogin = 구글_로그인(new GoogleLoginRequest(EMAIL_MEMBER_A)).as(LoginResponse.class);
//// CreateMissionRequest missionRequest = new CreateMissionRequest(DESCRIPTION, LocalDateTime.now(), LocalDateTime.now().plusDays(1), TimeOfDay.EVERYDAY, WEEK, 1);
//// 프로필_설정(new UpdateProfileRequest(NICKNAME_MEMBER_A, CHARACTER_MEMBER_A), memberALogin.accessToken());
//// MissionDetailResponse mission = 미션_생성(missionRequest, memberALogin.accessToken()).as(MissionDetailResponse.class);
////
//// LoginResponse memberBLogin = 구글_로그인(new GoogleLoginCommand(EMAIL_MEMBER_B, DEVICE_TOKEN)).as(LoginResponse.class);
//// LoginResponse memberBLogin = 구글_로그인(new GoogleLoginRequest(EMAIL_MEMBER_B)).as(LoginResponse.class);
////
//// ExtractableResponse<Response> response = 보드판_조회(mission.missionId(), memberBLogin.accessToken());
////
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.nexters.goalpanzi.acceptance;

import com.nexters.goalpanzi.application.auth.dto.request.GoogleLoginCommand;
import com.nexters.goalpanzi.application.auth.dto.response.LoginResponse;
import com.nexters.goalpanzi.application.mission.dto.response.MissionDetailResponse;
import com.nexters.goalpanzi.application.mission.dto.response.MissionsResponse;
import com.nexters.goalpanzi.domain.mission.DayOfWeek;
import com.nexters.goalpanzi.domain.mission.TimeOfDay;
import com.nexters.goalpanzi.domain.mission.repository.MissionMemberRepository;
import com.nexters.goalpanzi.presentation.auth.dto.GoogleLoginRequest;
import com.nexters.goalpanzi.presentation.mission.dto.CreateMissionRequest;
import com.nexters.goalpanzi.presentation.mission.dto.JoinMissionRequest;
import io.restassured.RestAssured;
Expand All @@ -22,7 +22,8 @@
import static com.nexters.goalpanzi.acceptance.AcceptanceStep.구글_로그인;
import static com.nexters.goalpanzi.acceptance.AcceptanceStep.미션_생성;
import static com.nexters.goalpanzi.exception.ErrorCode.CAN_NOT_JOIN_MISSION;
import static com.nexters.goalpanzi.fixture.MemberFixture.*;
import static com.nexters.goalpanzi.fixture.MemberFixture.EMAIL_HOST;
import static com.nexters.goalpanzi.fixture.MemberFixture.EMAIL_MEMBER_A;
import static com.nexters.goalpanzi.fixture.MissionFixture.DESCRIPTION;
import static com.nexters.goalpanzi.fixture.TokenFixture.BEARER;
import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -34,9 +35,9 @@ public class MissionMemberAcceptanceTest extends AcceptanceTest {

@Test
void 초대코드로_미션에_참여한다() {
LoginResponse loginHost = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse loginHost = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
MissionDetailResponse mission = 미션_생성(loginHost.accessToken()).as(MissionDetailResponse.class);
LoginResponse loginMember = 구글_로그인(new GoogleLoginCommand(EMAIL_MEMBER_A, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse loginMember = 구글_로그인(new GoogleLoginRequest(EMAIL_MEMBER_A)).as(LoginResponse.class);

JoinMissionRequest joinRequest = new JoinMissionRequest(mission.invitationCode());
RestAssured.given().log().all()
Expand All @@ -54,7 +55,7 @@ public class MissionMemberAcceptanceTest extends AcceptanceTest {

@Test
void 참여하고있는_미션을_조회한다() {
LoginResponse login = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
미션_생성(login.accessToken()).as(MissionDetailResponse.class);

MissionsResponse actual = RestAssured.given().log().all()
Expand All @@ -71,7 +72,7 @@ public class MissionMemberAcceptanceTest extends AcceptanceTest {

@Test
void 미션기간이_아닌경우_참여가_능하다() {
LoginResponse loginHost = 구글_로그인(new GoogleLoginCommand(EMAIL_HOST, DEVICE_TOKEN)).as(LoginResponse.class);
LoginResponse loginHost = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class);
CreateMissionRequest request = new CreateMissionRequest(DESCRIPTION, LocalDateTime.now(), LocalDateTime.now().plusDays(5), TimeOfDay.EVERYDAY, List.of(DayOfWeek.FRIDAY), 5);

RestAssured.given().log().all()
Expand Down
Loading

0 comments on commit adce1a5

Please sign in to comment.