Skip to content

Commit

Permalink
#34 - Test: 존재하지 않는 회원(username, password)에 대한 로그인 요청시 400(BadRequest…
Browse files Browse the repository at this point in the history
…) 응답 테스트
  • Loading branch information
ahah525 committed Nov 8, 2022
1 parent fc972c3 commit 330e0f3
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,44 @@ void t3() throws Exception {
resultActions
.andExpect(status().is4xxClientError());
}

@Test
@DisplayName("POST /api/v1/member/login 호출할 때 올바르지 않는 username 이나 password 를 입력하면 400")
void t4() throws Exception {
// When(존재하지 않는 아이디)
ResultActions resultActions = mvc
.perform(
post("/api/v1/member/login")
.content("""
{
"username": "user3",
"password": "1234"
}
""".stripIndent())
.contentType(new MediaType(MediaType.APPLICATION_JSON, StandardCharsets.UTF_8))
)
.andDo(print());

// Then
resultActions
.andExpect(status().is4xxClientError());

// when(비밀번호 틀림)
resultActions = mvc
.perform(
post("/api/v1/member/login")
.content("""
{
"username": "user1",
"password": "12345"
}
""".stripIndent())
.contentType(new MediaType(MediaType.APPLICATION_JSON, StandardCharsets.UTF_8))
)
.andDo(print());

// Then
resultActions
.andExpect(status().is4xxClientError());
}
}

0 comments on commit 330e0f3

Please sign in to comment.