mirror of https://github.com/usbharu/Hideout.git
chore: 不要な依存を削除
This commit is contained in:
parent
8992ff1928
commit
f2fea24fce
|
@ -163,9 +163,7 @@ dependencies {
|
|||
compileOnly("io.swagger.core.v3:swagger-annotations:2.2.6")
|
||||
implementation("io.swagger.core.v3:swagger-models:2.2.6")
|
||||
implementation("org.jetbrains.exposed:exposed-java-time:$exposed_version")
|
||||
testImplementation("org.springframework.boot:spring-boot-test-autoconfigure")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testImplementation("org.springframework.security:spring-security-test")
|
||||
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||
implementation("org.springframework.security:spring-security-oauth2-jose")
|
||||
|
@ -193,7 +191,6 @@ dependencies {
|
|||
implementation("io.ktor:ktor-client-content-negotiation:$ktor_version")
|
||||
testImplementation("io.ktor:ktor-client-mock:$ktor_version")
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
|
||||
testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0")
|
||||
testImplementation("org.mockito:mockito-inline:5.2.0")
|
||||
testImplementation("nl.jqno.equalsverifier:equalsverifier:3.15.3")
|
||||
|
|
|
@ -16,17 +16,10 @@ import org.mockito.Mock
|
|||
import org.mockito.junit.jupiter.MockitoExtension
|
||||
import org.mockito.kotlin.*
|
||||
import org.springframework.security.core.context.SecurityContextHolder
|
||||
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.anonymous
|
||||
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication
|
||||
import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity
|
||||
import org.springframework.security.web.DefaultSecurityFilterChain
|
||||
import org.springframework.security.web.FilterChainProxy
|
||||
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken
|
||||
import org.springframework.security.web.util.matcher.AnyRequestMatcher
|
||||
import org.springframework.test.web.servlet.MockMvc
|
||||
import org.springframework.test.web.servlet.get
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders
|
||||
import org.springframework.test.web.servlet.setup.StandaloneMockMvcBuilder
|
||||
import java.net.URL
|
||||
|
||||
@ExtendWith(MockitoExtension::class)
|
||||
|
@ -44,21 +37,21 @@ class NoteApControllerImplTest {
|
|||
fun setUp() {
|
||||
|
||||
mockMvc = MockMvcBuilders.standaloneSetup(noteApControllerImpl)
|
||||
.apply<StandaloneMockMvcBuilder>(
|
||||
springSecurity(
|
||||
FilterChainProxy(
|
||||
DefaultSecurityFilterChain(
|
||||
AnyRequestMatcher.INSTANCE
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
// .apply<StandaloneMockMvcBuilder>(
|
||||
// springSecurity(
|
||||
// FilterChainProxy(
|
||||
// DefaultSecurityFilterChain(
|
||||
// AnyRequestMatcher.INSTANCE
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
.build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `postAP 匿名で取得できる`() = runTest {
|
||||
|
||||
SecurityContextHolder.clearContext()
|
||||
val note = Note(
|
||||
name = "Note",
|
||||
id = "https://example.com/users/hoge/posts/1234",
|
||||
|
@ -74,7 +67,7 @@ class NoteApControllerImplTest {
|
|||
|
||||
mockMvc
|
||||
.get("/users/hoge/posts/1234") {
|
||||
with(anonymous())
|
||||
// with(anonymous())
|
||||
}
|
||||
.asyncDispatch()
|
||||
.andExpect { status { isOk() } }
|
||||
|
@ -83,11 +76,12 @@ class NoteApControllerImplTest {
|
|||
|
||||
@Test
|
||||
fun `postAP 存在しない場合は404`() = runTest {
|
||||
SecurityContextHolder.clearContext()
|
||||
whenever(noteApApiService.getNote(eq(123), isNull())).doReturn(null)
|
||||
|
||||
mockMvc
|
||||
.get("/users/hoge/posts/123") {
|
||||
with(anonymous())
|
||||
// with(anonymous())
|
||||
}
|
||||
.asyncDispatch()
|
||||
.andExpect { status { isNotFound() } }
|
||||
|
@ -117,11 +111,11 @@ class NoteApControllerImplTest {
|
|||
SecurityContextHolder.getContext().authentication = preAuthenticatedAuthenticationToken
|
||||
|
||||
mockMvc.get("/users/hoge/posts/1234") {
|
||||
with(
|
||||
authentication(
|
||||
preAuthenticatedAuthenticationToken
|
||||
)
|
||||
)
|
||||
// with(
|
||||
// authentication(
|
||||
// preAuthenticatedAuthenticationToken
|
||||
// )
|
||||
// )
|
||||
}.asyncDispatch()
|
||||
.andExpect { status { isOk() } }
|
||||
.andExpect { content { json(objectMapper.writeValueAsString(note)) } }
|
||||
|
|
Loading…
Reference in New Issue