Skip to content

Commit

Permalink
test: accessToken이 필요한 곳에 추가(#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
hong-sile committed Aug 13, 2024
1 parent b69b59e commit c77a67a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/java/play/pluv/api/LoginApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import static org.mockito.Mockito.when;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName;
import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
Expand Down Expand Up @@ -120,6 +122,9 @@ public class LoginApiTest extends ApiTest {
.andDo(document("google-login-add",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()),
requestHeaders(
headerWithName(AUTHORIZATION).description("Bearer Token")
),
requestFields(
fieldWithPath("idToken").type(STRING).description("구글의 idToken")
),
Expand Down Expand Up @@ -148,6 +153,9 @@ public class LoginApiTest extends ApiTest {
.andDo(document("spotify-login-add",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()),
requestHeaders(
headerWithName(AUTHORIZATION).description("Bearer Token")
),
requestFields(
fieldWithPath("accessToken").type(STRING).description("스포티파이의 accessToken")
),
Expand Down Expand Up @@ -176,6 +184,9 @@ public class LoginApiTest extends ApiTest {
.andDo(document("apple-login-add",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()),
requestHeaders(
headerWithName(AUTHORIZATION).description("Bearer Token")
),
requestFields(
fieldWithPath("idToken").type(STRING).description("apple의 idToken")
),
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/play/pluv/api/MemberApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import static org.mockito.Mockito.verify;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName;
import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
import static org.springframework.restdocs.payload.JsonFieldType.NUMBER;
import static org.springframework.restdocs.payload.JsonFieldType.STRING;
Expand Down Expand Up @@ -35,6 +37,9 @@ public class MemberApiTest extends ApiTest {
.header(AUTHORIZATION, "Bearer " + token))
.andExpect(status().isOk())
.andDo(document("update-nickname",
requestHeaders(
headerWithName(AUTHORIZATION).description("Bearer Token")
),
requestFields(
fieldWithPath("nickName").type(STRING).description("변경할 새로운 닉네임")
),
Expand All @@ -58,6 +63,9 @@ public class MemberApiTest extends ApiTest {
.header(AUTHORIZATION, "Bearer " + token))
.andExpect(status().isOk())
.andDo(document("unregister",
requestHeaders(
headerWithName(AUTHORIZATION).description("Bearer Token")
),
responseFields(
fieldWithPath("code").type(NUMBER).description("상태 코드"),
fieldWithPath("msg").type(STRING).description("상태 코드에 해당하는 메시지"),
Expand Down

0 comments on commit c77a67a

Please sign in to comment.