From da183caca0684f7f075189cc0df751561737d0b8 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Thu, 18 May 2023 15:45:37 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=E8=AA=8D=E8=A8=BC=E9=96=A2=E4=BF=82?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routing/activitypub/InboxRoutingKtTest.kt | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) 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 8e93e159..d1096731 100644 --- a/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt @@ -1,7 +1,6 @@ package dev.usbharu.hideout.routing.activitypub import dev.usbharu.hideout.exception.JsonParseException -import dev.usbharu.hideout.plugins.configureRouting import dev.usbharu.hideout.plugins.configureSerialization import dev.usbharu.hideout.plugins.configureStatusPages import dev.usbharu.hideout.service.activitypub.ActivityPubService @@ -11,6 +10,7 @@ import dev.usbharu.hideout.service.signature.HttpSignatureVerifyService import io.ktor.client.request.* import io.ktor.http.* import io.ktor.server.config.* +import io.ktor.server.routing.* import io.ktor.server.testing.* import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -27,7 +27,9 @@ class InboxRoutingKtTest { } application { configureSerialization() - configureRouting(mock(), mock(), mock(), mock(), mock()) + routing { + inbox(mock(), mock()) + } } client.get("/inbox").let { Assertions.assertEquals(HttpStatusCode.MethodNotAllowed, it.status) @@ -45,18 +47,14 @@ class InboxRoutingKtTest { val activityPubService = mock { on { parseActivity(any()) } doThrow JsonParseException() } - val userService = mock() - val activityPubUserService = mock() + mock() + mock() application { configureStatusPages() configureSerialization() - configureRouting( - httpSignatureVerifyService, - activityPubService, - userService, - activityPubUserService, - mock() - ) + routing { + inbox(httpSignatureVerifyService, activityPubService) + } } client.post("/inbox").let { Assertions.assertEquals(HttpStatusCode.BadRequest, it.status) @@ -70,7 +68,9 @@ class InboxRoutingKtTest { } application { configureSerialization() - configureRouting(mock(), mock(), mock(), mock(), mock()) + routing { + inbox(mock(), mock()) + } } client.get("/users/test/inbox").let { Assertions.assertEquals(HttpStatusCode.MethodNotAllowed, it.status) @@ -88,18 +88,14 @@ class InboxRoutingKtTest { val activityPubService = mock { on { parseActivity(any()) } doThrow JsonParseException() } - val userService = mock() - val activityPubUserService = mock() + mock() + mock() application { configureStatusPages() configureSerialization() - configureRouting( - httpSignatureVerifyService, - activityPubService, - userService, - activityPubUserService, - mock() - ) + routing { + inbox(httpSignatureVerifyService, activityPubService) + } } client.post("/users/test/inbox").let { Assertions.assertEquals(HttpStatusCode.BadRequest, it.status)