mirror of https://github.com/usbharu/Hideout.git
test: 認証関係を修正2
This commit is contained in:
parent
f0d5d8b672
commit
050efb1ee0
|
@ -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<ActivityPubService> {
|
||||
on { parseActivity(any()) } doThrow JsonParseException()
|
||||
}
|
||||
val userService = mock<IUserService>()
|
||||
val activityPubUserService = mock<ActivityPubUserService>()
|
||||
mock<IUserService>()
|
||||
mock<ActivityPubUserService>()
|
||||
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<ActivityPubService> {
|
||||
on { parseActivity(any()) } doThrow JsonParseException()
|
||||
}
|
||||
val userService = mock<IUserService>()
|
||||
val activityPubUserService = mock<ActivityPubUserService>()
|
||||
mock<IUserService>()
|
||||
mock<ActivityPubUserService>()
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue