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

This commit is contained in:
usbharu 2023-04-10 15:07:56 +09:00
parent 31e4218ef8
commit 2a3db9dddc
1 changed files with 23 additions and 0 deletions

View File

@ -70,4 +70,27 @@ class InboxRoutingKtTest {
Assertions.assertEquals(HttpStatusCode.MethodNotAllowed, it.status) 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)
}
}
} }