test: sharedInboxのテストを追加

This commit is contained in:
usbharu 2023-04-10 14:20:41 +09:00
parent 9558a53df1
commit e46dbb7b9b
2 changed files with 31 additions and 2 deletions

View File

@ -1,4 +1,33 @@
package dev.usbharu.hideout.routing.activitypub package dev.usbharu.hideout.routing.activitypub
class InboxRoutingKtTest {
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonSetter
import com.fasterxml.jackson.annotation.Nulls
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import dev.usbharu.hideout.plugins.configureRouting
import dev.usbharu.hideout.plugins.configureSerialization
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import io.ktor.server.config.*
import io.ktor.server.testing.*
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.kotlin.mock
class InboxRoutingKtTest {
@Test
fun `sharedInboxにGETしたら501が帰ってくる`() = testApplication {
environment {
config = ApplicationConfig("empty.conf")
}
application {
configureSerialization()
configureRouting(mock(), mock(), mock(), mock())
}
client.get("/inbox").let {
Assertions.assertEquals(HttpStatusCode.MethodNotAllowed, it.status)
}
}
} }

View File

@ -31,7 +31,7 @@ import kotlin.test.assertEquals
class UsersAPTest { class UsersAPTest {
@Test() @Test()
fun `ユーザのURLにAcceptヘッダーをActivityにしてアクセスしたときPersonが返ってくる`() = testApplication { fun `ユーザのURLにAcceptヘッダーをActivityにしてアクセスしたときPersonが返ってくる`() = testApplication {
environment { environment {
config = ApplicationConfig("empty.conf") config = ApplicationConfig("empty.conf")
} }