Skip to content

Commit

Permalink
test: token interceptor 변경에 따른 테스트를 수정한다
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb committed Mar 9, 2024
1 parent f0af419 commit bc775d5
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void REPLACE_BOOKMARK_SUCCESS_TEST() throws Exception {

// given
Long targetId = targetInitializer.saveTargetAndGetId("target", Instant.now());
String token = "token";
String token = "bearer token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedId(targetId)
.expectedToken(token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class FeedbackCreateAcceptanceTest extends AbstractFeedbackTestSupporter {
void CREATE_FEEDBACK_TO_SURVEY_SUCCESS() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("nalab", Instant.now());
String token = "nalab-token";
String token = "bearer nalab-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand All @@ -88,7 +88,7 @@ void CREATE_FEEDBACK_TO_SURVEY_SUCCESS() throws Exception {
void CREATE_MULTIPLE_FEEDBACK_TO_SURVEY_SUCCESS() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("hello", Instant.now());
String token = "hello-token";
String token = "bearer hello-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ReviewersFindAcceptanceTest extends AbstractFeedbackTestSupporter {
void FEEDBACKS_WITH_NO_REVIEWER_TEST() throws Exception {

// given
String token = "token";
String token = "bearer token";
Long targetId = targetInitializer.saveTargetAndGetId("sujin", Instant.now());
applicationEventPublisher.publishEvent(
MockUserRegisterEvent.builder().expectedToken(token).expectedId(targetId).build());
Expand All @@ -84,7 +84,7 @@ void FEEDBACKS_WITH_NO_REVIEWER_TEST() throws Exception {
void FEEDBACKS_WITH_REVIEWERS_TEST() throws Exception {

// given
String token = "token";
String token = "bearer token";
Long targetId = targetInitializer.saveTargetAndGetId("sujin", Instant.now());
applicationEventPublisher.publishEvent(
MockUserRegisterEvent.builder().expectedToken(token).expectedId(targetId).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class SpecificFindAcceptanceTest extends AbstractFeedbackTestSupporter {
void FIND_SPECIFIC_FEEDBACK_SUCCESS_TEST() throws Exception {

// given
String token = "token";
String token = "bearer token";
Long targetId = targetInitializer.saveTargetAndGetId("sujin", Instant.now());
applicationEventPublisher.publishEvent(
MockUserRegisterEvent.builder().expectedToken(token).expectedId(targetId).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class FeedbackFindSummaryAcceptanceTest extends AbstractFeedbackTestSupporter {
void FEEFBACK_SUMMARY_FIND_SUCCESS_TEST_WITH_NO_FEEDBACK() throws Exception {

// given
String token = "token";
String token = "bearer token";
Long targetId = targetInitializer.saveTargetAndGetId("sujin", Instant.now());
applicationEventPublisher.publishEvent(
MockUserRegisterEvent.builder().expectedToken(token).expectedId(targetId).build());
Expand All @@ -81,7 +81,7 @@ void FEEFBACK_SUMMARY_FIND_SUCCESS_TEST_WITH_NO_FEEDBACK() throws Exception {
void FEEFBACK_SUMMARY_FIND_SUCCESS_TEST_WITH_FEEDBACK() throws Exception {

// given
String token = "token";
String token = "bearer token";
Long targetId = targetInitializer.saveTargetAndGetId("sujin", Instant.now());
applicationEventPublisher.publishEvent(
MockUserRegisterEvent.builder().expectedToken(token).expectedId(targetId).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void FIND_REVIEWER_SUMMARY_SUCCESS() throws Exception {

private String saveTargetAndGetToken(String name) {
Long targetId = targetInitializer.saveTargetAndGetId("nalab", Instant.now());
String token = "nalab-token";
String token = "bearer nalab-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void BOOKMARK_SURVEY_TO_TOKEN_OWNER() throws Exception {
// given
var targetId = targetInitializer.saveTargetAndGetId("luffy",
LocalDateTime.now().minusYears(24).toInstant(ZoneOffset.UTC));
var token = "luffy's-double-token";
var token = "bearer luffy's-double-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void CREATE_NEW_SURVEY_SUCCESS_DEFAULT() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("luffy",
LocalDateTime.now().minusYears(24).toInstant(ZoneOffset.UTC));
String token = "luffy's-double-token";
String token = "bearer luffy's-double-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand All @@ -68,7 +68,7 @@ void CREATE_NEW_SURVEY_SUCCESS_SUCCESS_CUSTOM() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("luffy",
LocalDateTime.now().minusYears(24).toInstant(ZoneOffset.UTC));
String token = "luffy's-double-token";
String token = "bearer luffy's-double-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand All @@ -86,7 +86,7 @@ void CREATE_NEW_SURVEY_SUCCESS_SUCCESS_CUSTOM() throws Exception {
void CREATE_NEW_SURVEY_WITH_FAIL() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("luffy", LocalDateTime.now().minusYears(24).toInstant(ZoneOffset.UTC));
String token = "luffy's-double-token";
String token = "bearer luffy's-double-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SurveyExistsAcceptanceTest extends AbstractSurveyTestSupporter {
@DisplayName("token에 해당하는 survey가 존재한다면, true를 반환한다.")
void RETURN_TRUE_IF_SURVEY_EXISTS() throws Exception {
// given
String token = "luffy's-double-token";
String token = "bearer luffy's-double-token";
Long targetId = targetInitializer.saveTargetAndGetId("devxb", Instant.now());
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
Expand All @@ -59,7 +59,7 @@ void RETURN_TRUE_IF_SURVEY_EXISTS() throws Exception {
@DisplayName("token에 해당하는 survey가 존재하지 않는다면, false를 반환한다.")
void RETURN_FALSE_IF_SURVEY_DOES_NOT_EXISTS() throws Exception {
// given
String token = "luffy's-double-token";
String token = "bearer luffy's-double-token";
Long targetId = targetInitializer.saveTargetAndGetId("devxb", Instant.now());
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SurveyFindAcceptanceTest extends AbstractSurveyTestSupporter {
@Test
void SURVEY_FIND_SUCCESS_TEST() throws Exception {

String token = "luffy's-double-token";
String token = "bearer luffy's-double-token";
Long targetId = targetInitializer.saveTargetAndGetId("sujin", Instant.now());
applicationEventPublisher.publishEvent(
MockUserRegisterEvent.builder().expectedToken(token).expectedId(targetId).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SurveyFindidAcceptanceTest extends AbstractSurveyTestSupporter {
void GET_LOGINED_SURVEY_ID_SUCCESS() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("nalab", Instant.now());
String token = "nalab-token";
String token = "bearer nalab-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand All @@ -60,7 +60,7 @@ void GET_LOGINED_SURVEY_ID_SUCCESS() throws Exception {
void GET_LOGINED_SURVEY_ID_FAIL_NO_SURVEY() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("nalab", Instant.now());
String token = "nalab-token";
String token = "bearer nalab-token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TargetFindAcceptanceTest extends AbstractSurveyTestSupporter {
void FIND_TARGET_BY_SURVEY_ID_WITH_NO_AUTHORIZATION() throws Exception {
// given
Long targetId = targetInitializer.saveTargetAndGetId("target", Instant.now());
String token = "token";
String token = "bearer token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void TARGET_POSITION_UPDATE_SUCCESS_TEST() throws Exception {
// given
String nickname = "nickname";
Long targetId = targetInitializer.saveTargetAndGetId(nickname, Instant.now());
String token = "token";
String token = "bearer token";
applicationEventPublisher.publishEvent(MockUserRegisterEvent.builder()
.expectedToken(token)
.expectedId(targetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ void FAIL_LOGIN(HttpMethod httpMethod, String url, String requestToken, String e

static Stream<Arguments> successSources() {
return Stream.of(
of(HttpMethod.POST, "/v1/surveys", "token1", 1L)
, of(HttpMethod.POST, "/v1/surveys", "token1", 2L)
, of(HttpMethod.GET, "/v1/surveys-id", "token3", 3L)
, of(HttpMethod.GET, "/v1/questions?survey-id=4", "token4", 4L)
, of(HttpMethod.GET, "/v1/feedbacks?survey-id=5", "token5", 5L)
, of(HttpMethod.GET, "/v1/feedbacks/6", "token6", 6L)
, of(HttpMethod.GET, "/v1/feedbacks/summary?survey-id=7", "token7", 7L)
, of(HttpMethod.GET, "/v1/feedbacks?question-id=8", "token8", 8L)
of(HttpMethod.POST, "/v1/surveys", "bearer token1", 1L)
, of(HttpMethod.POST, "/v1/surveys", "bearer token1", 2L)
, of(HttpMethod.GET, "/v1/surveys-id", "bearer token3", 3L)
, of(HttpMethod.GET, "/v1/questions?survey-id=4", "bearer token4", 4L)
, of(HttpMethod.GET, "/v1/feedbacks?survey-id=5", "bearer token5", 5L)
, of(HttpMethod.GET, "/v1/feedbacks/6", "bearer token6", 6L)
, of(HttpMethod.GET, "/v1/feedbacks/summary?survey-id=7", "bearer token7", 7L)
, of(HttpMethod.GET, "/v1/feedbacks?question-id=8", "bearer token8", 8L)
);
}

static Stream<Arguments> failSources() {
return Stream.of(
of(HttpMethod.POST, "/v1/surveys", null, null, null)
, of(HttpMethod.GET, "/v1/users", null, "token2", 2L)
, of(HttpMethod.GET, "/v1/users", "token3", null, 3L)
, of(HttpMethod.GET, "/v1/users", "token4", "4nekot", 4L)
, of(HttpMethod.GET, "/v1/users", "token4", "token4", null)
, of(HttpMethod.GET, "/v1/users", null, "bearer token2", 2L)
, of(HttpMethod.GET, "/v1/users", "bearer token3", null, 3L)
, of(HttpMethod.GET, "/v1/users", "bearer token4", "bearer 4nekot", 4L)
, of(HttpMethod.GET, "/v1/users", "bearer token4", "bearer token4", null)
);
}

Expand Down

0 comments on commit bc775d5

Please sign in to comment.