diff --git a/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt b/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt index 1e545605..c4de8bfb 100644 --- a/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt @@ -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{ + on { verify(any()) } doReturn true + } + val activityPubService = mock{ + on { parseActivity(any()) } doThrow JsonParseException() + } + val userService = mock() + val activityPubUserService = mock() + application { + configureStatusPages() + configureSerialization() + configureRouting(httpSignatureVerifyService, activityPubService, userService, activityPubUserService) + } + client.post("/users/test/inbox").let { + Assertions.assertEquals(HttpStatusCode.BadRequest, it.status) + } + } }