mirror of https://github.com/usbharu/Hideout.git
test: テストコードをログインユーザー取得に対応
This commit is contained in:
parent
54b89c290a
commit
63632f7676
|
@ -1,6 +1,7 @@
|
||||||
package dev.usbharu.hideout.mastodon.interfaces.api.account
|
package dev.usbharu.hideout.mastodon.interfaces.api.account
|
||||||
|
|
||||||
import dev.usbharu.hideout.application.config.ActivityPubConfig
|
import dev.usbharu.hideout.application.config.ActivityPubConfig
|
||||||
|
import dev.usbharu.hideout.core.infrastructure.springframework.security.OAuth2JwtLoginUserContextHolder
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.AccountSource
|
import dev.usbharu.hideout.domain.mastodon.model.generated.AccountSource
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.CredentialAccount
|
import dev.usbharu.hideout.domain.mastodon.model.generated.CredentialAccount
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.Role
|
import dev.usbharu.hideout.domain.mastodon.model.generated.Role
|
||||||
|
@ -31,6 +32,9 @@ class MastodonAccountApiControllerTest {
|
||||||
|
|
||||||
private lateinit var mockMvc: MockMvc
|
private lateinit var mockMvc: MockMvc
|
||||||
|
|
||||||
|
@Spy
|
||||||
|
private val loginUserContextHolder = OAuth2JwtLoginUserContextHolder()
|
||||||
|
|
||||||
@Spy
|
@Spy
|
||||||
private lateinit var testTransaction: TestTransaction
|
private lateinit var testTransaction: TestTransaction
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package dev.usbharu.hideout.mastodon.interfaces.api.status
|
package dev.usbharu.hideout.mastodon.interfaces.api.status
|
||||||
|
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
|
import dev.usbharu.hideout.core.infrastructure.springframework.security.OAuth2JwtLoginUserContextHolder
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.Account
|
import dev.usbharu.hideout.domain.mastodon.model.generated.Account
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
|
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
|
||||||
import dev.usbharu.hideout.generate.JsonOrFormModelMethodProcessor
|
import dev.usbharu.hideout.generate.JsonOrFormModelMethodProcessor
|
||||||
|
@ -11,6 +12,7 @@ import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
import org.mockito.InjectMocks
|
import org.mockito.InjectMocks
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
import org.mockito.Spy
|
||||||
import org.mockito.junit.jupiter.MockitoExtension
|
import org.mockito.junit.jupiter.MockitoExtension
|
||||||
import org.mockito.kotlin.doReturn
|
import org.mockito.kotlin.doReturn
|
||||||
import org.mockito.kotlin.eq
|
import org.mockito.kotlin.eq
|
||||||
|
@ -30,6 +32,9 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestResponseBody
|
||||||
@ExtendWith(MockitoExtension::class)
|
@ExtendWith(MockitoExtension::class)
|
||||||
class MastodonStatusesApiControllerTest {
|
class MastodonStatusesApiControllerTest {
|
||||||
|
|
||||||
|
@Spy
|
||||||
|
private val loginUserContextHolder = OAuth2JwtLoginUserContextHolder()
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private lateinit var statusesApiService: StatusesApiService
|
private lateinit var statusesApiService: StatusesApiService
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package dev.usbharu.hideout.mastodon.interfaces.api.timeline
|
package dev.usbharu.hideout.mastodon.interfaces.api.timeline
|
||||||
|
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
|
import dev.usbharu.hideout.core.infrastructure.springframework.security.OAuth2JwtLoginUserContextHolder
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.Account
|
import dev.usbharu.hideout.domain.mastodon.model.generated.Account
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
|
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
|
||||||
import dev.usbharu.hideout.mastodon.service.timeline.TimelineApiService
|
import dev.usbharu.hideout.mastodon.service.timeline.TimelineApiService
|
||||||
|
@ -10,6 +11,7 @@ import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
import org.mockito.InjectMocks
|
import org.mockito.InjectMocks
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
import org.mockito.Spy
|
||||||
import org.mockito.junit.jupiter.MockitoExtension
|
import org.mockito.junit.jupiter.MockitoExtension
|
||||||
import org.mockito.kotlin.*
|
import org.mockito.kotlin.*
|
||||||
import org.springframework.security.core.context.SecurityContextHolder
|
import org.springframework.security.core.context.SecurityContextHolder
|
||||||
|
@ -23,6 +25,9 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders
|
||||||
@ExtendWith(MockitoExtension::class)
|
@ExtendWith(MockitoExtension::class)
|
||||||
class MastodonTimelineApiControllerTest {
|
class MastodonTimelineApiControllerTest {
|
||||||
|
|
||||||
|
@Spy
|
||||||
|
private val loginUserContextHolder = OAuth2JwtLoginUserContextHolder()
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private lateinit var timelineApiService: TimelineApiService
|
private lateinit var timelineApiService: TimelineApiService
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue