test: テストを修正

This commit is contained in:
usbharu 2024-01-16 14:39:03 +09:00
parent 70831ab2a9
commit 8bf5382f19
2 changed files with 8 additions and 3 deletions

View File

@ -53,7 +53,8 @@ class RejectTest {
"https://misskey.usbharu.dev/06407419-5aeb-4e2d-8885-aa54b03decf0",
Follow(
apObject = "https://misskey.usbharu.dev/users/97ws8y3rj6",
actor = "https://test-hideout.usbharu.dev/users/test-user2"
actor = "https://test-hideout.usbharu.dev/users/test-user2",
id = "https://misskey.usbharu.dev/follows/9mxh6mawru/97ws8y3rj6"
)
).apply { context = listOf("https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1") }

View File

@ -2,6 +2,7 @@ package dev.usbharu.hideout.activitypub.service.activity.follow
import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.hideout.activitypub.service.common.APRequestService
import dev.usbharu.hideout.application.config.ApplicationConfig
import dev.usbharu.hideout.core.service.follow.SendFollowDto
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Test
@ -10,12 +11,14 @@ import org.mockito.kotlin.mock
import org.mockito.kotlin.times
import org.mockito.kotlin.verify
import utils.UserBuilder
import java.net.URL
class APSendFollowServiceImplTest {
@Test
fun `sendFollow フォローするユーザーのinboxにFollowオブジェクトが送られる`() = runTest {
val apRequestService = mock<APRequestService>()
val apSendFollowServiceImpl = APSendFollowServiceImpl(apRequestService)
val applicationConfig = ApplicationConfig(URL("https://example.com"))
val apSendFollowServiceImpl = APSendFollowServiceImpl(apRequestService, applicationConfig)
val sendFollowDto = SendFollowDto(
UserBuilder.localUserOf(),
@ -25,7 +28,8 @@ class APSendFollowServiceImplTest {
val value = Follow(
apObject = sendFollowDto.followTargetActorId.url,
actor = sendFollowDto.actorId.url
actor = sendFollowDto.actorId.url,
id = "${applicationConfig.url}/follow/${sendFollowDto.actorId.id}/${sendFollowDto.followTargetActorId.id}"
)
verify(apRequestService, times(1)).apPost(
eq(sendFollowDto.followTargetActorId.inbox),