Skip to content

Commit

Permalink
refactor: 관리자 토큰 검증 실패 시 발생하는 예외 유형을 INVALID_ADMIN_ACCESS_TOKEN으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
amaran-th committed Nov 28, 2023
1 parent 2f2de41 commit 27bb2aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AdminValidator {

public static void validateAuthorization(final Member admin) {
if (admin.isNotMe(adminMemberId)) {
throw new LoginException(LoginExceptionType.INVALID_ACCESS_TOKEN);
throw new LoginException(LoginExceptionType.INVALID_ADMIN_ACCESS_TOKEN);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ void findActivity_fail_authorization() {
//then
assertThatThrownBy(actual)
.isInstanceOf(LoginException.class)
.hasMessage(LoginExceptionType.INVALID_ACCESS_TOKEN.errorMessage());
.hasMessage(LoginExceptionType.INVALID_ADMIN_ACCESS_TOKEN.errorMessage());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import static com.emmsale.image.ImageFixture.행사_이미지1;
import static com.emmsale.image.ImageFixture.행사_이미지2;
import static com.emmsale.image.ImageFixture.행사_이미지3;
import static com.emmsale.login.exception.LoginExceptionType.INVALID_ACCESS_TOKEN;
import static com.emmsale.login.exception.LoginExceptionType.INVALID_ADMIN_ACCESS_TOKEN;
import static com.emmsale.member.MemberFixture.adminMember;
import static com.emmsale.member.MemberFixture.generalMember;
import static com.emmsale.tag.TagFixture.AI;
Expand Down Expand Up @@ -268,7 +268,7 @@ void addEvent_fail_authorization() {
final LoginException exception = assertThrowsExactly(LoginException.class,
() -> eventCommandService.addEvent(request, mockMultipartFiles, generalMember()));

assertEquals(INVALID_ACCESS_TOKEN, exception.exceptionType());
assertEquals(INVALID_ADMIN_ACCESS_TOKEN, exception.exceptionType());
}
}

Expand Down Expand Up @@ -457,7 +457,7 @@ void updateEvent_fail_authorization() {
() -> eventCommandService.updateEvent(eventId, updateRequest, mockMultipartFiles,
generalMember()));

assertEquals(INVALID_ACCESS_TOKEN, exception.exceptionType());
assertEquals(INVALID_ADMIN_ACCESS_TOKEN, exception.exceptionType());
}
}

Expand Down Expand Up @@ -502,7 +502,7 @@ void deleteEvent_fail_authorization() {
final LoginException exception = assertThrowsExactly(LoginException.class,
() -> eventCommandService.deleteEvent(eventId, generalMember()));

assertEquals(INVALID_ACCESS_TOKEN, exception.exceptionType());
assertEquals(INVALID_ADMIN_ACCESS_TOKEN, exception.exceptionType());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ void findReports_fail_authorization() {
// then
assertThatThrownBy(actual)
.isInstanceOf(LoginException.class)
.hasMessage(LoginExceptionType.INVALID_ACCESS_TOKEN.errorMessage());
.hasMessage(LoginExceptionType.INVALID_ADMIN_ACCESS_TOKEN.errorMessage());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ void addTag_fail_authorization() {
//then
assertThatThrownBy(actual)
.isInstanceOf(LoginException.class)
.hasMessage(LoginExceptionType.INVALID_ACCESS_TOKEN.errorMessage());
.hasMessage(LoginExceptionType.INVALID_ADMIN_ACCESS_TOKEN.errorMessage());
}
}

0 comments on commit 27bb2aa

Please sign in to comment.