diff --git a/src/test/java/com/nexters/goalpanzi/acceptance/AcceptanceStep.java b/src/test/java/com/nexters/goalpanzi/acceptance/AcceptanceStep.java index 2f0de9cc..2fd8ace3 100644 --- a/src/test/java/com/nexters/goalpanzi/acceptance/AcceptanceStep.java +++ b/src/test/java/com/nexters/goalpanzi/acceptance/AcceptanceStep.java @@ -3,6 +3,7 @@ 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.UpdateDeviceTokenRequest; import com.nexters.goalpanzi.presentation.member.dto.UpdateProfileRequest; import com.nexters.goalpanzi.presentation.mission.dto.CreateMissionRequest; import com.nexters.goalpanzi.presentation.mission.dto.JoinMissionRequest; @@ -19,6 +20,7 @@ import java.time.LocalDateTime; import java.util.List; +import static com.nexters.goalpanzi.fixture.MemberFixture.DEVICE_TOKEN; import static com.nexters.goalpanzi.fixture.MissionFixture.DESCRIPTION; import static com.nexters.goalpanzi.fixture.TokenFixture.BEARER; @@ -142,4 +144,16 @@ public class AcceptanceStep { .then().log().all() .extract(); } + + public static ExtractableResponse 디바이스_토큰_갱신(String accessToken) { + UpdateDeviceTokenRequest request = new UpdateDeviceTokenRequest(DEVICE_TOKEN); + return RestAssured.given().log().all() + .contentType(MediaType.APPLICATION_JSON_VALUE) + .header(HttpHeaders.AUTHORIZATION, BEARER + accessToken) + .body(request) + .when().patch("/api/member/device-token") + .then().log().all() + .statusCode(HttpStatus.OK.value()) + .extract(); + } } diff --git a/src/test/java/com/nexters/goalpanzi/acceptance/MemberAcceptanceTest.java b/src/test/java/com/nexters/goalpanzi/acceptance/MemberAcceptanceTest.java index 69aeaec9..e62cd11c 100644 --- a/src/test/java/com/nexters/goalpanzi/acceptance/MemberAcceptanceTest.java +++ b/src/test/java/com/nexters/goalpanzi/acceptance/MemberAcceptanceTest.java @@ -94,6 +94,7 @@ public class MemberAcceptanceTest extends AcceptanceTest { @Test void 푸시_알림_활성화_여부를_수정한다() { LoginResponse login = 구글_로그인(new GoogleLoginRequest(EMAIL_HOST)).as(LoginResponse.class); + 디바이스_토큰_갱신(login.accessToken()); UpdatePushActivationStatusRequest request = new UpdatePushActivationStatusRequest(true); RestAssured.given().log().all()