generated from pricelees/issue-pr-template
[#34] 회원 / 인증 도메인 재정의 #43
@ -52,12 +52,8 @@ class JwtUtilsTest : FunSpec() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test("claim에 입력된 key의 정보가 없으면 실패한다.") {
|
test("claim에 입력된 key의 정보가 없으면 null을 반환한다.") {
|
||||||
shouldThrow<AuthException> {
|
jwtUtils.extractClaim(token = commonToken, key = "abcde") shouldBe null
|
||||||
jwtUtils.extractClaim(token = commonToken, key = "abcde")
|
|
||||||
}.also {
|
|
||||||
it.errorCode shouldBe AuthErrorCode.INVALID_TOKEN
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test("토큰이 만료되면 실패한다.") {
|
test("토큰이 만료되면 실패한다.") {
|
||||||
|
|||||||
@ -15,12 +15,12 @@ class ApiLogMessageConverterTest : StringSpec({
|
|||||||
val request: HttpServletRequest = mockk()
|
val request: HttpServletRequest = mockk()
|
||||||
|
|
||||||
beforeTest {
|
beforeTest {
|
||||||
MDC.remove("member_id")
|
MDC.remove("principal_id")
|
||||||
MDC.put("member_id", "1")
|
MDC.put("principal_id", "1")
|
||||||
}
|
}
|
||||||
|
|
||||||
afterSpec {
|
afterSpec {
|
||||||
MDC.remove("member_id")
|
MDC.remove("principal_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
"HTTP 요청 메시지를 변환한다." {
|
"HTTP 요청 메시지를 변환한다." {
|
||||||
@ -44,7 +44,7 @@ class ApiLogMessageConverterTest : StringSpec({
|
|||||||
val requestURI = "/test/sangdol".also { every { request.requestURI } returns it }
|
val requestURI = "/test/sangdol".also { every { request.requestURI } returns it }
|
||||||
|
|
||||||
converter.convertToControllerInvokedMessage(request, controllerPayload) shouldBe """
|
converter.convertToControllerInvokedMessage(request, controllerPayload) shouldBe """
|
||||||
{"type":"CONTROLLER_INVOKED","method":"$method","uri":"$requestURI","member_id":1,"controller_method":"${
|
{"type":"CONTROLLER_INVOKED","method":"$method","uri":"$requestURI","principal_id":1,"controller_method":"${
|
||||||
controllerPayload.get(
|
controllerPayload.get(
|
||||||
"controller_method"
|
"controller_method"
|
||||||
)
|
)
|
||||||
@ -62,7 +62,7 @@ class ApiLogMessageConverterTest : StringSpec({
|
|||||||
)
|
)
|
||||||
|
|
||||||
converter.convertToResponseMessage(request) shouldBe """
|
converter.convertToResponseMessage(request) shouldBe """
|
||||||
{"type":"CONTROLLER_SUCCESS","endpoint":"$endpoint","status_code":200,"member_id":1,"exception":{"class":"AuthException","message":"테스트 메시지!"}}
|
{"type":"CONTROLLER_SUCCESS","endpoint":"$endpoint","status_code":200,"principal_id":1,"exception":{"class":"AuthException","message":"테스트 메시지!"}}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user