test: ユーザーのinboxのPOSTのテストを追加

This commit is contained in:
usbharu 2023-04-10 15:07:56 +09:00
parent 02501287d4
commit 8f27746ff2
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
1 changed files with 23 additions and 0 deletions

View File

@ -70,4 +70,27 @@ class InboxRoutingKtTest {
Assertions.assertEquals(HttpStatusCode.MethodNotAllowed, it.status)
}
}
@Test
fun `ユーザーのinboxに空のリクエストボディでPOSTしたら400が帰ってくる`() = testApplication {
environment {
config = ApplicationConfig("empty.conf")
}
val httpSignatureVerifyService = mock<HttpSignatureVerifyService>{
on { verify(any()) } doReturn true
}
val activityPubService = mock<ActivityPubService>{
on { parseActivity(any()) } doThrow JsonParseException()
}
val userService = mock<UserService>()
val activityPubUserService = mock<ActivityPubUserService>()
application {
configureStatusPages()
configureSerialization()
configureRouting(httpSignatureVerifyService, activityPubService, userService, activityPubUserService)
}
client.post("/users/test/inbox").let {
Assertions.assertEquals(HttpStatusCode.BadRequest, it.status)
}
}
}