mirror of https://github.com/usbharu/Hideout.git
style: fix lint
This commit is contained in:
parent
73451a1918
commit
4e4cada0b7
|
@ -46,12 +46,10 @@ allprojects {
|
||||||
subprojects {
|
subprojects {
|
||||||
apply {
|
apply {
|
||||||
plugin(rootProject.libs.plugins.kotlin.jvm.get().pluginId)
|
plugin(rootProject.libs.plugins.kotlin.jvm.get().pluginId)
|
||||||
plugin(rootProject.libs.plugins.detekt.get().pluginId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
detektPlugins(rootProject.libs.detekt.formatting)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +59,6 @@ tasks {
|
||||||
}
|
}
|
||||||
withType<io.gitlab.arturbosch.detekt.Detekt> {
|
withType<io.gitlab.arturbosch.detekt.Detekt> {
|
||||||
exclude("**/generated/**")
|
exclude("**/generated/**")
|
||||||
setSource("src/main/kotlin")
|
|
||||||
exclude("build/")
|
exclude("build/")
|
||||||
configureEach {
|
configureEach {
|
||||||
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
|
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
|
||||||
|
@ -82,6 +79,7 @@ dependencies {
|
||||||
implementation(project(":hideout-core"))
|
implementation(project(":hideout-core"))
|
||||||
implementation(project(":hideout-mastodon"))
|
implementation(project(":hideout-mastodon"))
|
||||||
implementation(project(":hideout-activitypub"))
|
implementation(project(":hideout-activitypub"))
|
||||||
|
detektPlugins(rootProject.libs.detekt.formatting)
|
||||||
}
|
}
|
||||||
|
|
||||||
springBoot {
|
springBoot {
|
||||||
|
@ -104,6 +102,6 @@ detekt {
|
||||||
parallel = true
|
parallel = true
|
||||||
config.setFrom(files("../detekt.yml"))
|
config.setFrom(files("../detekt.yml"))
|
||||||
buildUponDefaultConfig = true
|
buildUponDefaultConfig = true
|
||||||
basePath = "${rootDir.absolutePath}/src/main/kotlin"
|
source.setFrom(files(subprojects.map { "${it.projectDir}/src/main/kotlin" }))
|
||||||
autoCorrect = true
|
autoCorrect = true
|
||||||
}
|
}
|
|
@ -54,8 +54,14 @@ class ExposedUserTimelineQueryService : UserTimelineQueryService, AbstractReposi
|
||||||
.where {
|
.where {
|
||||||
Posts.visibility eq Visibility.PUBLIC.name or
|
Posts.visibility eq Visibility.PUBLIC.name or
|
||||||
(Posts.visibility eq Visibility.UNLISTED.name) or
|
(Posts.visibility eq Visibility.UNLISTED.name) or
|
||||||
(Posts.visibility eq Visibility.DIRECT.name and (PostsVisibleActors.actorId eq principal.actorId.id)) or
|
(
|
||||||
(Posts.visibility eq Visibility.FOLLOWERS.name and (Relationships.blocking eq false and (relationshipsAlias[Relationships.following] eq true))) or
|
Posts.visibility eq Visibility.DIRECT.name and
|
||||||
|
(PostsVisibleActors.actorId eq principal.actorId.id)
|
||||||
|
) or
|
||||||
|
(
|
||||||
|
Posts.visibility eq Visibility.FOLLOWERS.name and
|
||||||
|
(Relationships.blocking eq false and (relationshipsAlias[Relationships.following] eq true))
|
||||||
|
) or
|
||||||
(Posts.actorId eq principal.actorId.id)
|
(Posts.actorId eq principal.actorId.id)
|
||||||
}
|
}
|
||||||
.alias("authorized_table")
|
.alias("authorized_table")
|
||||||
|
|
|
@ -44,7 +44,8 @@ class GetUserDetailApplicationServiceTest {
|
||||||
fun userDetailを取得できる() = runTest {
|
fun userDetailを取得できる() = runTest {
|
||||||
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(
|
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(
|
||||||
UserDetail.create(
|
UserDetail.create(
|
||||||
UserDetailId(1), ActorId(1),
|
UserDetailId(1),
|
||||||
|
ActorId(1),
|
||||||
UserDetailHashedPassword("")
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -56,7 +57,6 @@ class GetUserDetailApplicationServiceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun userDetailが存在しない場合失敗() = runTest {
|
fun userDetailが存在しない場合失敗() = runTest {
|
||||||
|
|
||||||
assertThrows<IllegalArgumentException> {
|
assertThrows<IllegalArgumentException> {
|
||||||
service.execute(GetUserDetail(2), Anonymous)
|
service.execute(GetUserDetail(2), Anonymous)
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,8 @@ class GetUserDetailApplicationServiceTest {
|
||||||
fun userDetailが存在するけどActorが存在しない場合はInternalServerException() = runTest {
|
fun userDetailが存在するけどActorが存在しない場合はInternalServerException() = runTest {
|
||||||
whenever(userDetailRepository.findById(UserDetailId(2))).doReturn(
|
whenever(userDetailRepository.findById(UserDetailId(2))).doReturn(
|
||||||
UserDetail.create(
|
UserDetail.create(
|
||||||
UserDetailId(2), ActorId(2),
|
UserDetailId(2),
|
||||||
|
ActorId(2),
|
||||||
UserDetailHashedPassword("")
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -75,4 +76,4 @@ class GetUserDetailApplicationServiceTest {
|
||||||
service.execute(GetUserDetail(2), Anonymous)
|
service.execute(GetUserDetail(2), Anonymous)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,8 @@ class MigrationLocalActorApplicationServiceTest {
|
||||||
fun fromのactorが見つからなかったら失敗() = runTest {
|
fun fromのactorが見つからなかったら失敗() = runTest {
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword
|
||||||
("")
|
("")
|
||||||
)
|
)
|
||||||
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(userDetail)
|
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(userDetail)
|
||||||
|
@ -73,7 +74,8 @@ class MigrationLocalActorApplicationServiceTest {
|
||||||
fun toのactorが見つからなかったら失敗() = runTest {
|
fun toのactorが見つからなかったら失敗() = runTest {
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword
|
||||||
("")
|
("")
|
||||||
)
|
)
|
||||||
whenever(actorRepository.findById(ActorId(1))).doReturn(TestActorFactory.create(1))
|
whenever(actorRepository.findById(ActorId(1))).doReturn(TestActorFactory.create(1))
|
||||||
|
@ -102,7 +104,8 @@ class MigrationLocalActorApplicationServiceTest {
|
||||||
val to = TestActorFactory.create(2)
|
val to = TestActorFactory.create(2)
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword
|
||||||
("")
|
("")
|
||||||
)
|
)
|
||||||
whenever(actorRepository.findById(ActorId(1))).doReturn(from)
|
whenever(actorRepository.findById(ActorId(1))).doReturn(from)
|
||||||
|
@ -136,7 +139,8 @@ class MigrationLocalActorApplicationServiceTest {
|
||||||
val to = TestActorFactory.create(2)
|
val to = TestActorFactory.create(2)
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword
|
||||||
("")
|
("")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -168,4 +172,4 @@ class MigrationLocalActorApplicationServiceTest {
|
||||||
|
|
||||||
verify(actorRepository, never()).save(any())
|
verify(actorRepository, never()).save(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,4 @@ class RegisterLocalActorApplicationServiceTest {
|
||||||
service.execute(RegisterLocalActor("test", "password"), Anonymous)
|
service.execute(RegisterLocalActor("test", "password"), Anonymous)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -61,4 +61,4 @@ class StartDeleteLocalActorApplicationServiceTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,9 @@ class RegisterApplicationApplicationServiceTest {
|
||||||
argumentCaptor<RegisteredClient> {
|
argumentCaptor<RegisteredClient> {
|
||||||
verify(registeredClientRepository).save(capture())
|
verify(registeredClientRepository).save(capture())
|
||||||
val first = allValues.first()
|
val first = allValues.first()
|
||||||
assertThat(first.tokenSettings.accessTokenTimeToLive).isGreaterThanOrEqualTo(Duration.ofSeconds(31536000000))
|
assertThat(
|
||||||
|
first.tokenSettings.accessTokenTimeToLive
|
||||||
|
).isGreaterThanOrEqualTo(Duration.ofSeconds(31536000000))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +79,6 @@ class RegisterApplicationApplicationServiceTest {
|
||||||
verify(registeredClientRepository).save(capture())
|
verify(registeredClientRepository).save(capture())
|
||||||
val first = allValues.first()
|
val first = allValues.first()
|
||||||
assertThat(first.authorizationGrantTypes).contains(AuthorizationGrantType.REFRESH_TOKEN)
|
assertThat(first.authorizationGrantTypes).contains(AuthorizationGrantType.REFRESH_TOKEN)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,26 @@ class UserDeleteFilterApplicationServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun フィルターを削除できる() = runTest {
|
fun フィルターを削除できる() = runTest {
|
||||||
val filter = Filter(
|
val filter = Filter(
|
||||||
FilterId(1), UserDetailId(1), FilterName("filter"), setOf(FilterContext.HOME), FilterAction.HIDE, setOf(
|
FilterId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
FilterName("filter"),
|
||||||
|
setOf(FilterContext.HOME),
|
||||||
|
FilterAction.HIDE,
|
||||||
|
setOf(
|
||||||
FilterKeyword(
|
FilterKeyword(
|
||||||
FilterKeywordId(1), FilterKeywordKeyword("aaa"), FilterMode.NONE
|
FilterKeywordId(1),
|
||||||
|
FilterKeywordKeyword("aaa"),
|
||||||
|
FilterMode.NONE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
whenever(filterRepository.findByFilterId(FilterId(1))).doReturn(filter)
|
whenever(filterRepository.findByFilterId(FilterId(1))).doReturn(filter)
|
||||||
|
|
||||||
service.execute(
|
service.execute(
|
||||||
DeleteFilter(1), LocalUser(
|
DeleteFilter(1),
|
||||||
ActorId(1), UserDetailId(1),
|
LocalUser(
|
||||||
|
ActorId(1),
|
||||||
|
UserDetailId(1),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -56,8 +65,10 @@ class UserDeleteFilterApplicationServiceTest {
|
||||||
fun フィルターが見つからない場合失敗() = runTest {
|
fun フィルターが見つからない場合失敗() = runTest {
|
||||||
assertThrows<IllegalArgumentException> {
|
assertThrows<IllegalArgumentException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
DeleteFilter(1), LocalUser(
|
DeleteFilter(1),
|
||||||
ActorId(1), UserDetailId(1),
|
LocalUser(
|
||||||
|
ActorId(1),
|
||||||
|
UserDetailId(1),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -67,9 +78,16 @@ class UserDeleteFilterApplicationServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun フィルターのオーナー以外は失敗() = runTest {
|
fun フィルターのオーナー以外は失敗() = runTest {
|
||||||
val filter = Filter(
|
val filter = Filter(
|
||||||
FilterId(1), UserDetailId(1), FilterName("filter"), setOf(FilterContext.HOME), FilterAction.HIDE, setOf(
|
FilterId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
FilterName("filter"),
|
||||||
|
setOf(FilterContext.HOME),
|
||||||
|
FilterAction.HIDE,
|
||||||
|
setOf(
|
||||||
FilterKeyword(
|
FilterKeyword(
|
||||||
FilterKeywordId(1), FilterKeywordKeyword("aaa"), FilterMode.NONE
|
FilterKeywordId(1),
|
||||||
|
FilterKeywordKeyword("aaa"),
|
||||||
|
FilterMode.NONE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -77,8 +95,10 @@ class UserDeleteFilterApplicationServiceTest {
|
||||||
|
|
||||||
assertThrows<PermissionDeniedException> {
|
assertThrows<PermissionDeniedException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
DeleteFilter(1), LocalUser(
|
DeleteFilter(1),
|
||||||
ActorId(3), UserDetailId(3),
|
LocalUser(
|
||||||
|
ActorId(3),
|
||||||
|
UserDetailId(3),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -86,4 +106,4 @@ class UserDeleteFilterApplicationServiceTest {
|
||||||
|
|
||||||
verify(filterRepository, never()).delete(any())
|
verify(filterRepository, never()).delete(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,26 @@ class UserGetFilterApplicationServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun オーナーのみ取得できる() = runTest {
|
fun オーナーのみ取得できる() = runTest {
|
||||||
val filter = Filter(
|
val filter = Filter(
|
||||||
FilterId(1), UserDetailId(1), FilterName("filter"), setOf(FilterContext.HOME), FilterAction.HIDE, setOf(
|
FilterId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
FilterName("filter"),
|
||||||
|
setOf(FilterContext.HOME),
|
||||||
|
FilterAction.HIDE,
|
||||||
|
setOf(
|
||||||
FilterKeyword(
|
FilterKeyword(
|
||||||
FilterKeywordId(1), FilterKeywordKeyword("aaa"), FilterMode.NONE
|
FilterKeywordId(1),
|
||||||
|
FilterKeywordKeyword("aaa"),
|
||||||
|
FilterMode.NONE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
whenever(filterRepository.findByFilterId(FilterId(1))).doReturn(filter)
|
whenever(filterRepository.findByFilterId(FilterId(1))).doReturn(filter)
|
||||||
|
|
||||||
service.execute(
|
service.execute(
|
||||||
GetFilter(1), LocalUser(
|
GetFilter(1),
|
||||||
ActorId(1), UserDetailId(1),
|
LocalUser(
|
||||||
|
ActorId(1),
|
||||||
|
UserDetailId(1),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -53,19 +62,27 @@ class UserGetFilterApplicationServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun オーナー以外は失敗() = runTest {
|
fun オーナー以外は失敗() = runTest {
|
||||||
val filter = Filter(
|
val filter = Filter(
|
||||||
FilterId(1), UserDetailId(1), FilterName("filter"), setOf(FilterContext.HOME), FilterAction.HIDE, setOf(
|
FilterId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
FilterName("filter"),
|
||||||
|
setOf(FilterContext.HOME),
|
||||||
|
FilterAction.HIDE,
|
||||||
|
setOf(
|
||||||
FilterKeyword(
|
FilterKeyword(
|
||||||
FilterKeywordId(1), FilterKeywordKeyword("aaa"), FilterMode.NONE
|
FilterKeywordId(1),
|
||||||
|
FilterKeywordKeyword("aaa"),
|
||||||
|
FilterMode.NONE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
whenever(filterRepository.findByFilterId(FilterId(1))).doReturn(filter)
|
whenever(filterRepository.findByFilterId(FilterId(1))).doReturn(filter)
|
||||||
|
|
||||||
|
|
||||||
assertThrows<PermissionDeniedException> {
|
assertThrows<PermissionDeniedException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
GetFilter(1), LocalUser(
|
GetFilter(1),
|
||||||
ActorId(3), UserDetailId(3),
|
LocalUser(
|
||||||
|
ActorId(3),
|
||||||
|
UserDetailId(3),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -76,11 +93,13 @@ class UserGetFilterApplicationServiceTest {
|
||||||
fun フィルターが見つからない場合失敗() = runTest {
|
fun フィルターが見つからない場合失敗() = runTest {
|
||||||
assertThrows<IllegalArgumentException> {
|
assertThrows<IllegalArgumentException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
GetFilter(1), LocalUser(
|
GetFilter(1),
|
||||||
ActorId(3), UserDetailId(3),
|
LocalUser(
|
||||||
|
ActorId(3),
|
||||||
|
UserDetailId(3),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,4 +52,4 @@ class DeleteLocalPostApplicationServiceTest {
|
||||||
service.execute(DeleteLocalPost(1), LocalUser(ActorId(3), UserDetailId(3), Acct("test", "example.com")))
|
service.execute(DeleteLocalPost(1), LocalUser(ActorId(3), UserDetailId(3), Acct("test", "example.com")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,11 @@ class RegisterLocalPostApplicationServiceTest {
|
||||||
).doReturn(post)
|
).doReturn(post)
|
||||||
|
|
||||||
service.execute(
|
service.execute(
|
||||||
RegisterLocalPost("content test", null, Visibility.PUBLIC, null, null, false, emptyList()), LocalUser(
|
RegisterLocalPost("content test", null, Visibility.PUBLIC, null, null, false, emptyList()),
|
||||||
ActorId(1), UserDetailId(1), Acct("test", "example.com")
|
LocalUser(
|
||||||
|
ActorId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -71,10 +74,13 @@ class RegisterLocalPostApplicationServiceTest {
|
||||||
fun actorが見つからないと失敗() = runTest {
|
fun actorが見つからないと失敗() = runTest {
|
||||||
assertThrows<InternalServerException> {
|
assertThrows<InternalServerException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
RegisterLocalPost("content test", null, Visibility.PUBLIC, null, null, false, emptyList()), LocalUser(
|
RegisterLocalPost("content test", null, Visibility.PUBLIC, null, null, false, emptyList()),
|
||||||
ActorId(1), UserDetailId(1), Acct("test", "example.com")
|
LocalUser(
|
||||||
|
ActorId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
@Spy
|
@Spy
|
||||||
val transaction = TestTransaction
|
val transaction = TestTransaction
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun Post主はPostを編集できる() = runTest {
|
fun Post主はPostを編集できる() = runTest {
|
||||||
val post = TestPostFactory.create()
|
val post = TestPostFactory.create()
|
||||||
|
@ -54,7 +53,8 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
whenever(postRepository.findById(post.id)).doReturn(post)
|
whenever(postRepository.findById(post.id)).doReturn(post)
|
||||||
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(
|
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(
|
||||||
UserDetail.create(
|
UserDetail.create(
|
||||||
UserDetailId(1), post.actorId,
|
UserDetailId(1),
|
||||||
|
post.actorId,
|
||||||
UserDetailHashedPassword("")
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -63,7 +63,8 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
whenever(postContentFactoryImpl.create(eq("test"))).doReturn(content)
|
whenever(postContentFactoryImpl.create(eq("test"))).doReturn(content)
|
||||||
|
|
||||||
service.execute(
|
service.execute(
|
||||||
UpdateLocalNote(post.id.id, null, "test", false, emptyList()), LocalUser(
|
UpdateLocalNote(post.id.id, null, "test", false, emptyList()),
|
||||||
|
LocalUser(
|
||||||
post.actorId,
|
post.actorId,
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
|
@ -75,7 +76,8 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
val first = allValues.first()
|
val first = allValues.first()
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
content, first.content
|
content,
|
||||||
|
first.content
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,9 +86,11 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
fun postが見つからない場合失敗() = runTest {
|
fun postが見つからない場合失敗() = runTest {
|
||||||
assertThrows<IllegalArgumentException> {
|
assertThrows<IllegalArgumentException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
UpdateLocalNote(1, null, "test", false, emptyList()), LocalUser(
|
UpdateLocalNote(1, null, "test", false, emptyList()),
|
||||||
|
LocalUser(
|
||||||
ActorId(1),
|
ActorId(1),
|
||||||
UserDetailId(1), Acct("test", "example.com")
|
UserDetailId(1),
|
||||||
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -98,9 +102,11 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
|
|
||||||
assertThrows<PermissionDeniedException> {
|
assertThrows<PermissionDeniedException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
UpdateLocalNote(1, null, "test", false, emptyList()), LocalUser(
|
UpdateLocalNote(1, null, "test", false, emptyList()),
|
||||||
|
LocalUser(
|
||||||
ActorId(1),
|
ActorId(1),
|
||||||
UserDetailId(1), Acct("test", "example.com")
|
UserDetailId(1),
|
||||||
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -112,9 +118,11 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
|
|
||||||
assertThrows<InternalServerException> {
|
assertThrows<InternalServerException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
UpdateLocalNote(1, null, "test", false, emptyList()), LocalUser(
|
UpdateLocalNote(1, null, "test", false, emptyList()),
|
||||||
|
LocalUser(
|
||||||
ActorId(1),
|
ActorId(1),
|
||||||
UserDetailId(1), Acct("test", "example.com")
|
UserDetailId(1),
|
||||||
|
Acct("test", "example.com")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -130,15 +138,16 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
whenever(postRepository.findById(post.id)).doReturn(post)
|
whenever(postRepository.findById(post.id)).doReturn(post)
|
||||||
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(
|
whenever(userDetailRepository.findById(UserDetailId(1))).doReturn(
|
||||||
UserDetail.create(
|
UserDetail.create(
|
||||||
UserDetailId(1), post.actorId,
|
UserDetailId(1),
|
||||||
|
post.actorId,
|
||||||
UserDetailHashedPassword("")
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
assertThrows<InternalServerException> {
|
assertThrows<InternalServerException> {
|
||||||
service.execute(
|
service.execute(
|
||||||
UpdateLocalNote(post.id.id, null, "test", false, emptyList()), LocalUser(
|
UpdateLocalNote(post.id.id, null, "test", false, emptyList()),
|
||||||
|
LocalUser(
|
||||||
post.actorId,
|
post.actorId,
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
Acct("test", "example.com")
|
Acct("test", "example.com")
|
||||||
|
@ -149,4 +158,4 @@ class UpdateLocalNoteApplicationServiceTest {
|
||||||
verify(actorRepository, times(1)).findById(ActorId(1))
|
verify(actorRepository, times(1)).findById(ActorId(1))
|
||||||
verify(postRepository, never()).save(any())
|
verify(postRepository, never()).save(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,14 @@ class UserAcceptFollowRequestApplicationServiceTest {
|
||||||
whenever(actorRepository.findById(ActorId(2))).doReturn(TestActorFactory.create(id = 2))
|
whenever(actorRepository.findById(ActorId(2))).doReturn(TestActorFactory.create(id = 2))
|
||||||
whenever(relationshipRepository.findByActorIdAndTargetId(ActorId(1), ActorId(2))).doReturn(
|
whenever(relationshipRepository.findByActorIdAndTargetId(ActorId(1), ActorId(2))).doReturn(
|
||||||
Relationship(
|
Relationship(
|
||||||
actorId = ActorId(1), targetActorId = ActorId
|
actorId = ActorId(1),
|
||||||
|
targetActorId = ActorId
|
||||||
(2),
|
(2),
|
||||||
following = false,
|
following = false,
|
||||||
blocking = false,
|
blocking = false,
|
||||||
muting = false,
|
muting = false,
|
||||||
followRequesting = true, mutingFollowRequest = false
|
followRequesting = true,
|
||||||
|
mutingFollowRequest = false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
service.execute(AcceptFollowRequest(1), LocalUser(ActorId(2), UserDetailId(2), Acct("test", "example.com")))
|
service.execute(AcceptFollowRequest(1), LocalUser(ActorId(2), UserDetailId(2), Acct("test", "example.com")))
|
||||||
|
@ -80,4 +82,4 @@ class UserAcceptFollowRequestApplicationServiceTest {
|
||||||
assertTrue(first.following)
|
assertTrue(first.following)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ class LocalUserAbstractApplicationServiceTest {
|
||||||
val logger = LoggerFactory.getLogger(javaClass)
|
val logger = LoggerFactory.getLogger(javaClass)
|
||||||
val value = object : LocalUserAbstractApplicationService<Unit, Unit>(TestTransaction, logger) {
|
val value = object : LocalUserAbstractApplicationService<Unit, Unit>(TestTransaction, logger) {
|
||||||
override suspend fun internalExecute(command: Unit, principal: LocalUser) {
|
override suspend fun internalExecute(command: Unit, principal: LocalUser) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,4 +21,4 @@ class LocalUserAbstractApplicationServiceTest {
|
||||||
value.execute(Unit, Anonymous)
|
value.execute(Unit, Anonymous)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,4 @@ class ActorDescriptionTest {
|
||||||
|
|
||||||
assertEquals(ActorDescription.LENGTH, actorScreenName.description.length)
|
assertEquals(ActorDescription.LENGTH, actorScreenName.description.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@ class ActorIdTest {
|
||||||
ActorId(-1)
|
ActorId(-1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,4 @@ class ActorKeyIdTest {
|
||||||
ActorKeyId("aiueo")
|
ActorKeyId("aiueo")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,4 +32,4 @@ class ActorNameTest {
|
||||||
ActorName("test-user")
|
ActorName("test-user")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,4 @@ class ActorPostsCountTest {
|
||||||
ActorPostsCount(1)
|
ActorPostsCount(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,4 @@ class ActorPrivateKeyTest {
|
||||||
.joinToString("\n") + "\n-----END PRIVATE KEY-----"
|
.joinToString("\n") + "\n-----END PRIVATE KEY-----"
|
||||||
assertEquals(key, actorPrivateKey.privateKey)
|
assertEquals(key, actorPrivateKey.privateKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,4 @@ class ActorPublicKeyTest {
|
||||||
.joinToString("\n") + "\n-----END PUBLIC KEY-----"
|
.joinToString("\n") + "\n-----END PUBLIC KEY-----"
|
||||||
assertEquals(key, actorPublicKey.publicKey)
|
assertEquals(key, actorPublicKey.publicKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,4 @@ class ActorRelationshipCountTest {
|
||||||
ActorRelationshipCount(1)
|
ActorRelationshipCount(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,4 @@ class ActorScreenNameTest {
|
||||||
|
|
||||||
assertEquals(ActorScreenName.LENGTH, actorScreenName.screenName.length)
|
assertEquals(ActorScreenName.LENGTH, actorScreenName.screenName.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ class ActorsTest {
|
||||||
fun moveToに自分自身が設定された場合moveイベントが発生し更新される() {
|
fun moveToに自分自身が設定された場合moveイベントが発生し更新される() {
|
||||||
val actor = TestActorFactory.create(publicKey = ActorPublicKey(""))
|
val actor = TestActorFactory.create(publicKey = ActorPublicKey(""))
|
||||||
|
|
||||||
|
|
||||||
actor.setMoveTo(ActorId(100))
|
actor.setMoveTo(ActorId(100))
|
||||||
|
|
||||||
assertContainsEvent(actor, ActorEvent.MOVE.eventName)
|
assertContainsEvent(actor, ActorEvent.MOVE.eventName)
|
||||||
|
@ -146,4 +145,4 @@ class ActorsTest {
|
||||||
|
|
||||||
assertContainsEvent(actor, ActorEvent.UPDATE.eventName)
|
assertContainsEvent(actor, ActorEvent.UPDATE.eventName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,4 +80,4 @@ object TestActorFactory {
|
||||||
private fun generateId(): Long = runBlocking {
|
private fun generateId(): Long = runBlocking {
|
||||||
idGenerateService.generateId()
|
idGenerateService.generateId()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,4 +74,4 @@ class ActorInstanceRelationshipTest {
|
||||||
assertFalse(default.blocking)
|
assertFalse(default.blocking)
|
||||||
assertFalse(default.doNotSendPrivate)
|
assertFalse(default.doNotSendPrivate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,4 @@ class ApplicationIdTest {
|
||||||
ApplicationId(1)
|
ApplicationId(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,4 @@ class ApplicationTest {
|
||||||
ApplicationName("aiueo")
|
ApplicationName("aiueo")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,4 @@ class CustomEmojiIdTest {
|
||||||
CustomEmojiId(1)
|
CustomEmojiId(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,4 @@ class FilterIdTest {
|
||||||
FilterId(1)
|
FilterId(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,4 @@ class FilterNameTest {
|
||||||
|
|
||||||
assertEquals(FilterName.LENGTH, filterName.name.length)
|
assertEquals(FilterName.LENGTH, filterName.name.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,10 @@ class FilterTest {
|
||||||
FilterKeywordKeyword("keyword"),
|
FilterKeywordKeyword("keyword"),
|
||||||
FilterMode.NONE
|
FilterMode.NONE
|
||||||
)
|
)
|
||||||
), userDetail
|
),
|
||||||
|
userDetail
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -60,7 +60,6 @@ class FilterTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
kotlin.test.assertEquals("(hoge)", filter.compileFilter().pattern)
|
kotlin.test.assertEquals("(hoge)", filter.compileFilter().pattern)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -81,7 +80,6 @@ class FilterTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
kotlin.test.assertEquals("\\b(hoge)\\b", filter.compileFilter().pattern)
|
kotlin.test.assertEquals("\\b(hoge)\\b", filter.compileFilter().pattern)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -102,7 +100,6 @@ class FilterTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
kotlin.test.assertEquals("(hoge)", filter.compileFilter().pattern)
|
kotlin.test.assertEquals("(hoge)", filter.compileFilter().pattern)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -133,7 +130,5 @@ class FilterTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
kotlin.test.assertEquals("\\b(hoge)\\b|(hoge)|(hoge)", filter.compileFilter().pattern)
|
kotlin.test.assertEquals("\\b(hoge)\\b|(hoge)|(hoge)", filter.compileFilter().pattern)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,6 @@ class PostTest {
|
||||||
val actor = TestActorFactory.create(id = post.actorId.id, publicKey = ActorPublicKey(""))
|
val actor = TestActorFactory.create(id = post.actorId.id, publicKey = ActorPublicKey(""))
|
||||||
post.setVisibility(Visibility.UNLISTED, actor)
|
post.setVisibility(Visibility.UNLISTED, actor)
|
||||||
assertEmpty(post)
|
assertEmpty(post)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -392,9 +391,7 @@ class PostTest {
|
||||||
fun `create 作成できる`() {
|
fun `create 作成できる`() {
|
||||||
val actor = TestActorFactory.create(suspend = true)
|
val actor = TestActorFactory.create(suspend = true)
|
||||||
|
|
||||||
|
|
||||||
assertDoesNotThrow {
|
assertDoesNotThrow {
|
||||||
|
|
||||||
Post.create(
|
Post.create(
|
||||||
id = PostId(1),
|
id = PostId(1),
|
||||||
actorId = actor.id,
|
actorId = actor.id,
|
||||||
|
@ -422,9 +419,7 @@ class PostTest {
|
||||||
fun `create 作成できる2`() {
|
fun `create 作成できる2`() {
|
||||||
val actor = TestActorFactory.create(suspend = true)
|
val actor = TestActorFactory.create(suspend = true)
|
||||||
|
|
||||||
|
|
||||||
assertDoesNotThrow {
|
assertDoesNotThrow {
|
||||||
|
|
||||||
Post.create(
|
Post.create(
|
||||||
id = PostId(1),
|
id = PostId(1),
|
||||||
actorId = actor.id,
|
actorId = actor.id,
|
||||||
|
@ -467,7 +462,6 @@ class PostTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(PostContent.empty.emojiIds, post.emojiIds)
|
assertEquals(PostContent.empty.emojiIds, post.emojiIds)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -532,7 +526,6 @@ class PostTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(emptyList(), post.mediaIds)
|
assertEquals(emptyList(), post.mediaIds)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -563,7 +556,6 @@ class PostTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `delete deleteイベントが発生する`() {
|
fun `delete deleteイベントが発生する`() {
|
||||||
|
|
||||||
val actor = TestActorFactory.create()
|
val actor = TestActorFactory.create()
|
||||||
val post = TestPostFactory.create(deleted = false, actorId = actor.id.id)
|
val post = TestPostFactory.create(deleted = false, actorId = actor.id.id)
|
||||||
post.delete(actor)
|
post.delete(actor)
|
||||||
|
@ -572,7 +564,6 @@ class PostTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `delete すでにdeletedがtrueの時deleteイベントは発生しない`() {
|
fun `delete すでにdeletedがtrueの時deleteイベントは発生しない`() {
|
||||||
|
|
||||||
val actor = TestActorFactory.create()
|
val actor = TestActorFactory.create()
|
||||||
val post = TestPostFactory.create(deleted = true, actorId = actor.id.id)
|
val post = TestPostFactory.create(deleted = true, actorId = actor.id.id)
|
||||||
post.delete(actor)
|
post.delete(actor)
|
||||||
|
|
|
@ -56,4 +56,4 @@ object TestPostFactory {
|
||||||
private fun generateId(): Long = runBlocking {
|
private fun generateId(): Long = runBlocking {
|
||||||
idGenerateService.generateId()
|
idGenerateService.generateId()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,4 +149,4 @@ class RelationshipTest {
|
||||||
assertFalse(relationship.followRequesting)
|
assertFalse(relationship.followRequesting)
|
||||||
assertContainsEvent(relationship, RelationshipEvent.REJECT_FOLLOW.eventName)
|
assertContainsEvent(relationship, RelationshipEvent.REJECT_FOLLOW.eventName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package dev.usbharu.hideout.core.domain.model.support.domain
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.assertThrows
|
import org.junit.jupiter.api.assertThrows
|
||||||
|
|
||||||
|
|
||||||
class DomainTest {
|
class DomainTest {
|
||||||
@Test
|
@Test
|
||||||
fun `1000超過の長さは失敗`() {
|
fun `1000超過の長さは失敗`() {
|
||||||
|
@ -11,4 +10,4 @@ class DomainTest {
|
||||||
Domain("a".repeat(1001))
|
Domain("a".repeat(1001))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,4 @@ class RemoteActorCheckDomainServiceTest {
|
||||||
|
|
||||||
assertFalse(localActor)
|
assertFalse(localActor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,4 @@ class LocalActorDomainServiceImplTest {
|
||||||
fun generateKeyPair() = runTest {
|
fun generateKeyPair() = runTest {
|
||||||
service.generateKeyPair()
|
service.generateKeyPair()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
val to = TestActorFactory.create()
|
val to = TestActorFactory.create()
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
userDetail.lastMigration = Instant.now().minusSeconds(100)
|
userDetail.lastMigration = Instant.now().minusSeconds(100)
|
||||||
|
|
||||||
|
@ -33,12 +34,12 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun 自分自身に引っ越しできない(): Unit = runTest {
|
fun 自分自身に引っ越しできない(): Unit = runTest {
|
||||||
|
|
||||||
val from = TestActorFactory.create()
|
val from = TestActorFactory.create()
|
||||||
val to = TestActorFactory.create()
|
val to = TestActorFactory.create()
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
||||||
|
|
||||||
|
@ -49,12 +50,12 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun 引越し先が引っ越している場合は引っ越しできない(): Unit = runTest {
|
fun 引越し先が引っ越している場合は引っ越しできない(): Unit = runTest {
|
||||||
|
|
||||||
val from = TestActorFactory.create()
|
val from = TestActorFactory.create()
|
||||||
val to = TestActorFactory.create(moveTo = 100)
|
val to = TestActorFactory.create(moveTo = 100)
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
||||||
|
|
||||||
|
@ -69,7 +70,8 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
val to = TestActorFactory.create()
|
val to = TestActorFactory.create()
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
||||||
|
|
||||||
|
@ -84,7 +86,8 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
val to = TestActorFactory.create(alsoKnownAs = setOf(ActorId(100)))
|
val to = TestActorFactory.create(alsoKnownAs = setOf(ActorId(100)))
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
||||||
|
|
||||||
|
@ -99,7 +102,8 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
val to = TestActorFactory.create(alsoKnownAs = setOf(from.id, ActorId(100)))
|
val to = TestActorFactory.create(alsoKnownAs = setOf(from.id, ActorId(100)))
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
||||||
|
|
||||||
|
@ -114,7 +118,8 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
val to = TestActorFactory.create(alsoKnownAs = setOf(from.id, ActorId(100)))
|
val to = TestActorFactory.create(alsoKnownAs = setOf(from.id, ActorId(100)))
|
||||||
val userDetail = UserDetail.create(
|
val userDetail = UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
userDetail.lastMigration = Instant.now().minus(31.days.toJavaDuration())
|
userDetail.lastMigration = Instant.now().minus(31.days.toJavaDuration())
|
||||||
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
val localActorMigrationCheckDomainServiceImpl = LocalActorMigrationCheckDomainServiceImpl()
|
||||||
|
@ -123,4 +128,4 @@ class LocalActorMigrationCheckDomainServiceImplTest {
|
||||||
|
|
||||||
assertInstanceOf(AccountMigrationCheck.CanAccountMigration::class.java, canAccountMigration)
|
assertInstanceOf(AccountMigrationCheck.CanAccountMigration::class.java, canAccountMigration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,8 @@ class FilterDomainServiceTest {
|
||||||
setOf(FilterKeyword(FilterKeywordId(1), FilterKeywordKeyword("test"), FilterMode.NONE))
|
setOf(FilterKeyword(FilterKeywordId(1), FilterKeywordKeyword("test"), FilterMode.NONE))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
val filteredPosts = FilterDomainService().applyAll(postList, FilterContext.HOME, filters = listOf(filter))
|
val filteredPosts = FilterDomainService().applyAll(postList, FilterContext.HOME, filters = listOf(filter))
|
||||||
|
|
||||||
assertEquals(5, filteredPosts.size)
|
assertEquals(5, filteredPosts.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,6 @@ class DefaultPostReadAccessControlTest {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
val actual = service.isAllow(
|
val actual = service.isAllow(
|
||||||
TestPostFactory.create(actorId = 1, visibility = Visibility.FOLLOWERS),
|
TestPostFactory.create(actorId = 1, visibility = Visibility.FOLLOWERS),
|
||||||
LocalUser(ActorId(2), UserDetailId(2), Acct("test", "example.com"))
|
LocalUser(ActorId(2), UserDetailId(2), Acct("test", "example.com"))
|
||||||
|
@ -150,7 +149,6 @@ class DefaultPostReadAccessControlTest {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
val actual = service.isAllow(
|
val actual = service.isAllow(
|
||||||
TestPostFactory.create(actorId = 1, visibility = Visibility.FOLLOWERS),
|
TestPostFactory.create(actorId = 1, visibility = Visibility.FOLLOWERS),
|
||||||
LocalUser(ActorId(2), UserDetailId(2), Acct("test", "example.com"))
|
LocalUser(ActorId(2), UserDetailId(2), Acct("test", "example.com"))
|
||||||
|
@ -234,7 +232,6 @@ class DefaultPostReadAccessControlTest {
|
||||||
assertAll(actual.map { { assertEquals(1, it.actorId.id) } })
|
assertAll(actual.map { { assertEquals(1, it.actorId.id) } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun areAllows_PUBLICとUNLISTEDは見れる() = runTest {
|
fun areAllows_PUBLICとUNLISTEDは見れる() = runTest {
|
||||||
whenever(
|
whenever(
|
||||||
|
@ -265,7 +262,9 @@ class DefaultPostReadAccessControlTest {
|
||||||
val actual = service.areAllows(postList, LocalUser(ActorId(1), UserDetailId(1), Acct("test", "example.com")))
|
val actual = service.areAllows(postList, LocalUser(ActorId(1), UserDetailId(1), Acct("test", "example.com")))
|
||||||
|
|
||||||
assertEquals(2, actual.size)
|
assertEquals(2, actual.size)
|
||||||
kotlin.test.assertTrue(actual.all { it.visibility == Visibility.PUBLIC || it.visibility == Visibility.UNLISTED })
|
kotlin.test.assertTrue(
|
||||||
|
actual.all { it.visibility == Visibility.PUBLIC || it.visibility == Visibility.UNLISTED }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -298,7 +297,9 @@ class DefaultPostReadAccessControlTest {
|
||||||
val actual = service.areAllows(postList, Anonymous)
|
val actual = service.areAllows(postList, Anonymous)
|
||||||
|
|
||||||
assertEquals(2, actual.size)
|
assertEquals(2, actual.size)
|
||||||
kotlin.test.assertTrue(actual.all { it.visibility == Visibility.PUBLIC || it.visibility == Visibility.UNLISTED })
|
kotlin.test.assertTrue(
|
||||||
|
actual.all { it.visibility == Visibility.PUBLIC || it.visibility == Visibility.UNLISTED }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -371,4 +372,4 @@ class DefaultPostReadAccessControlTest {
|
||||||
assertEquals(1, actual.size)
|
assertEquals(1, actual.size)
|
||||||
assertAll(actual.map { { assertEquals(2, it.actorId.id) } })
|
assertAll(actual.map { { assertEquals(2, it.actorId.id) } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,4 +133,4 @@ class RelationshipDomainServiceTest {
|
||||||
|
|
||||||
assertTrue(relationship.followRequesting)
|
assertTrue(relationship.followRequesting)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,4 @@ class UserDetailDomainServiceTest {
|
||||||
|
|
||||||
assertNotEquals("password", hashedPassword.password)
|
assertNotEquals("password", hashedPassword.password)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,4 @@ class EmojiKtUnicodeEmojiServiceTest {
|
||||||
fun 絵文字の判定ができる(s: String) {
|
fun 絵文字の判定ができる(s: String) {
|
||||||
assertTrue(EmojiKtUnicodeEmojiService().isUnicodeEmoji(s))
|
assertTrue(EmojiKtUnicodeEmojiService().isUnicodeEmoji(s))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -93,9 +93,12 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
}
|
}
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
|
|
||||||
val actorInstanceRelationship = ActorInstanceRelationship(
|
val actorInstanceRelationship = ActorInstanceRelationship(
|
||||||
actorId = ActorId(1), instanceId = InstanceId(1), blocking = false, muting = false, doNotSendPrivate = false
|
actorId = ActorId(1),
|
||||||
|
instanceId = InstanceId(1),
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
doNotSendPrivate = false
|
||||||
)
|
)
|
||||||
|
|
||||||
repository.save(actorInstanceRelationship)
|
repository.save(actorInstanceRelationship)
|
||||||
|
@ -173,9 +176,12 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
}
|
}
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
|
|
||||||
val actorInstanceRelationship = ActorInstanceRelationship(
|
val actorInstanceRelationship = ActorInstanceRelationship(
|
||||||
actorId = ActorId(1), instanceId = InstanceId(1), blocking = false, muting = false, doNotSendPrivate = false
|
actorId = ActorId(1),
|
||||||
|
instanceId = InstanceId(1),
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
doNotSendPrivate = false
|
||||||
)
|
)
|
||||||
|
|
||||||
repository.save(actorInstanceRelationship)
|
repository.save(actorInstanceRelationship)
|
||||||
|
@ -201,7 +207,11 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val actorInstanceRelationship = ActorInstanceRelationship(
|
val actorInstanceRelationship = ActorInstanceRelationship(
|
||||||
actorId = ActorId(1), instanceId = InstanceId(1), blocking = false, muting = false, doNotSendPrivate = false
|
actorId = ActorId(1),
|
||||||
|
instanceId = InstanceId(1),
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
doNotSendPrivate = false
|
||||||
)
|
)
|
||||||
|
|
||||||
change.setStartPointNow()
|
change.setStartPointNow()
|
||||||
|
@ -228,7 +238,11 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val expected = ActorInstanceRelationship(
|
val expected = ActorInstanceRelationship(
|
||||||
actorId = ActorId(1), instanceId = InstanceId(1), blocking = true, muting = true, doNotSendPrivate = true
|
actorId = ActorId(1),
|
||||||
|
instanceId = InstanceId(1),
|
||||||
|
blocking = true,
|
||||||
|
muting = true,
|
||||||
|
doNotSendPrivate = true
|
||||||
)
|
)
|
||||||
|
|
||||||
val actual = repository.findByActorIdAndInstanceId(ActorId(1), InstanceId(1))
|
val actual = repository.findByActorIdAndInstanceId(ActorId(1), InstanceId(1))
|
||||||
|
@ -249,13 +263,16 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun save_ドメインイベントがパブリッシュされる() = runTest {
|
fun save_ドメインイベントがパブリッシュされる() = runTest {
|
||||||
|
|
||||||
dbSetup(to = dataSource) {
|
dbSetup(to = dataSource) {
|
||||||
execute(disableReferenceIntegrityConstraints)
|
execute(disableReferenceIntegrityConstraints)
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val actorInstanceRelationship = ActorInstanceRelationship(
|
val actorInstanceRelationship = ActorInstanceRelationship(
|
||||||
actorId = ActorId(1), instanceId = InstanceId(1), blocking = false, muting = false, doNotSendPrivate = false
|
actorId = ActorId(1),
|
||||||
|
instanceId = InstanceId(1),
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
doNotSendPrivate = false
|
||||||
)
|
)
|
||||||
actorInstanceRelationship.block()
|
actorInstanceRelationship.block()
|
||||||
repository.save(actorInstanceRelationship)
|
repository.save(actorInstanceRelationship)
|
||||||
|
@ -267,7 +284,6 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun delete_ドメインイベントがパブリッシュされる() = runTest {
|
fun delete_ドメインイベントがパブリッシュされる() = runTest {
|
||||||
|
|
||||||
dbSetup(to = dataSource) {
|
dbSetup(to = dataSource) {
|
||||||
execute(disableReferenceIntegrityConstraints)
|
execute(disableReferenceIntegrityConstraints)
|
||||||
insertInto(ActorInstanceRelationships.tableName) {
|
insertInto(ActorInstanceRelationships.tableName) {
|
||||||
|
@ -277,7 +293,11 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val actorInstanceRelationship = ActorInstanceRelationship(
|
val actorInstanceRelationship = ActorInstanceRelationship(
|
||||||
actorId = ActorId(1), instanceId = InstanceId(1), blocking = false, muting = false, doNotSendPrivate = false
|
actorId = ActorId(1),
|
||||||
|
instanceId = InstanceId(1),
|
||||||
|
blocking = false,
|
||||||
|
muting = false,
|
||||||
|
doNotSendPrivate = false
|
||||||
)
|
)
|
||||||
actorInstanceRelationship.block()
|
actorInstanceRelationship.block()
|
||||||
repository.delete(actorInstanceRelationship)
|
repository.delete(actorInstanceRelationship)
|
||||||
|
@ -286,4 +306,4 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
|
||||||
|
|
||||||
verify(domainEventPublisher, times(1)).publishEvent(any())
|
verify(domainEventPublisher, times(1)).publishEvent(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,9 @@ class ExposedActorRepositoryTest : AbstractRepositoryTest(Actors) {
|
||||||
inbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/inbox"),
|
inbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/inbox"),
|
||||||
outbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/outbox"),
|
outbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/outbox"),
|
||||||
uri = URI.create("https://test-hideout-dev.usbharu.dev/users/b"),
|
uri = URI.create("https://test-hideout-dev.usbharu.dev/users/b"),
|
||||||
publicKey = ActorPublicKey("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyuMjzmQBsSxzK6NkOpZh\nWuohaUbzCY7AafXt+3+tiL6LulYNg/YRIqKc7Q/vTJE6CHrqo7RA/OqYrSMxF/LC\nf8aX5aHwJE1A2gSgCcs1IL5GJaYRlp4NcuazpBC9NO4xIrvH//jcVnZGXGWsCbls\nHXZGZdurWOF0Bl3mYN8CdupVumrGuOPs+wbI/Gh+OHw611TcXMyAwFwU2UjvPEgk\nEACW9OvJaq1K40jVCAa3b1nXt53vlXXZEUlL78L0C9xuFbJG0K/GKMBN44GyftJO\nhA95Rf1Nhd0vKDLBiRocGcARmBo9PaSCR5651gJEk5/wfLUnNAf0xj3R8LBoOhnT\nCQIDAQAB\n-----END PUBLIC KEY-----"),
|
publicKey = ActorPublicKey(
|
||||||
|
"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyuMjzmQBsSxzK6NkOpZh\nWuohaUbzCY7AafXt+3+tiL6LulYNg/YRIqKc7Q/vTJE6CHrqo7RA/OqYrSMxF/LC\nf8aX5aHwJE1A2gSgCcs1IL5GJaYRlp4NcuazpBC9NO4xIrvH//jcVnZGXGWsCbls\nHXZGZdurWOF0Bl3mYN8CdupVumrGuOPs+wbI/Gh+OHw611TcXMyAwFwU2UjvPEgk\nEACW9OvJaq1K40jVCAa3b1nXt53vlXXZEUlL78L0C9xuFbJG0K/GKMBN44GyftJO\nhA95Rf1Nhd0vKDLBiRocGcARmBo9PaSCR5651gJEk5/wfLUnNAf0xj3R8LBoOhnT\nCQIDAQAB\n-----END PUBLIC KEY-----"
|
||||||
|
),
|
||||||
privateKey = ActorPrivateKey(
|
privateKey = ActorPrivateKey(
|
||||||
"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDK4yPOZAGxLHMr\no2Q6lmFa6iFpRvMJjsBp9e37f62Ivou6Vg2D9hEiopztD+9MkToIeuqjtED86pit\nIzEX8sJ/xpflofAkTUDaBKAJyzUgvkYlphGWng1y5rOkEL007jEiu8f/+NxWdkZc\nZawJuWwddkZl26tY4XQGXeZg3wJ26lW6asa44+z7Bsj8aH44fDrXVNxczIDAXBTZ\nSO88SCQQAJb068lqrUrjSNUIBrdvWde3ne+VddkRSUvvwvQL3G4VskbQr8YowE3j\ngbJ+0k6ED3lF/U2F3S8oMsGJGhwZwBGYGj09pIJHnrnWAkSTn/B8tSc0B/TGPdHw\nsGg6GdMJAgMBAAECggEAHkEhLEb70kdOGgJLUR9D/5zYBE0eXdz/MsMyd1AH+Shs\n9AmetKsYzWDmuhp9Cp5swyn328Hmn7B+DvInVn+5YvjNhY07SbaJcVls4g5UQFXk\nu6WC4ZfKap7IyAeaUg54858r8677xcWXuByN5dn+1iU2hJGYK3Cx7rx0PRrUURYG\n2BRaEEwkcPNm9u679OOTyvTmA3NhewUuDaTMkZnnAml87uYYnmFKjQcR+S2UqOm6\nvBZ/devG4TfPBeKEAya/ba8JJ8frGOtjmR9EIliTQoxI2izeAfoGs1OsCSpuPy6s\nV5f0X3HYM7CA+Fpkt2pnixuwg96LaVr4OpVxujhNlwKBgQD1827VuKFGrneNO+c+\n4EIvh+vLh462bJiaVsMHfRhNZF1/5i8gfNJ16ST60hJo11E4riHPzi3q6GWuxOYl\nCkVKvhJ2g3mgnhoehcgnT7UBkasaC7JYd+LsFDnWOTVSJOy2OqfLdLDGAuSTN3kO\nBF4p0ZqQ/AouFNin57WNRGVZ7wKBgQDTLUZtfTkOU3G1nIMTRKmZjqdER5glzHCm\n9o/1ZsQktL+nzSXqYeoWh9fr7fkmC0k/07+SHzzfWvOhWWWlRenUVL5mj7FRq+L9\n9kDjChLR3Jr4L6Sj1iaQ+0uqDSQNYSYO9ctMjAVjFiNhiAd+S6B451Q1VbDKTCHt\nkRW9omz6hwKBgBFTsgY6eJorJl77zmG+mMsSb0kqZqJxahrNa/X2GSUyoeelxsIq\nKQWHhERrUkKykJVGpzkllFSNRMSYOIJ5g8ItO82/m2z2Vm66DAzA78aJhZ1TH6Bd\n6c2p6x0tcJU15rs7zKBnuyBoCcRZTxzur9eQXaxDJVBzxYOmrkKig+VfAoGBAMCP\n2Fiehxh5HobsYNmBEuXjHsM0RZiyA0c8LakoPFL8PodUme5PupUw6cNJDJeUUwbQ\nny8vLOK+nMnUKsu6JK5pV/VNsfM3OZU6p5Bf7ylOcEE/sHF1JVWu0CAQO3+3xmx9\n1RPH2mGwHjMhRzPy4jFdP3wi10KgiY+HbLuvEJChAoGAYCsh3UhtTzGUOlPBkmLL\n17bD0wN4J/fOv8BoXPZ8H2CdqVgWy0s+s+QaPqRxNcA6YyGymBqrmQAn1Uii25r9\nKAwVAjg3S2KDEMSI2RbMMmQJSZ1u0GkxqOUC/MMeZqBYTYxVeqcQPoqJZ0Nk7IOA\nZPFif8bVfcZqeimxrFaV6YI=\n-----END PRIVATE KEY-----",
|
"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDK4yPOZAGxLHMr\no2Q6lmFa6iFpRvMJjsBp9e37f62Ivou6Vg2D9hEiopztD+9MkToIeuqjtED86pit\nIzEX8sJ/xpflofAkTUDaBKAJyzUgvkYlphGWng1y5rOkEL007jEiu8f/+NxWdkZc\nZawJuWwddkZl26tY4XQGXeZg3wJ26lW6asa44+z7Bsj8aH44fDrXVNxczIDAXBTZ\nSO88SCQQAJb068lqrUrjSNUIBrdvWde3ne+VddkRSUvvwvQL3G4VskbQr8YowE3j\ngbJ+0k6ED3lF/U2F3S8oMsGJGhwZwBGYGj09pIJHnrnWAkSTn/B8tSc0B/TGPdHw\nsGg6GdMJAgMBAAECggEAHkEhLEb70kdOGgJLUR9D/5zYBE0eXdz/MsMyd1AH+Shs\n9AmetKsYzWDmuhp9Cp5swyn328Hmn7B+DvInVn+5YvjNhY07SbaJcVls4g5UQFXk\nu6WC4ZfKap7IyAeaUg54858r8677xcWXuByN5dn+1iU2hJGYK3Cx7rx0PRrUURYG\n2BRaEEwkcPNm9u679OOTyvTmA3NhewUuDaTMkZnnAml87uYYnmFKjQcR+S2UqOm6\nvBZ/devG4TfPBeKEAya/ba8JJ8frGOtjmR9EIliTQoxI2izeAfoGs1OsCSpuPy6s\nV5f0X3HYM7CA+Fpkt2pnixuwg96LaVr4OpVxujhNlwKBgQD1827VuKFGrneNO+c+\n4EIvh+vLh462bJiaVsMHfRhNZF1/5i8gfNJ16ST60hJo11E4riHPzi3q6GWuxOYl\nCkVKvhJ2g3mgnhoehcgnT7UBkasaC7JYd+LsFDnWOTVSJOy2OqfLdLDGAuSTN3kO\nBF4p0ZqQ/AouFNin57WNRGVZ7wKBgQDTLUZtfTkOU3G1nIMTRKmZjqdER5glzHCm\n9o/1ZsQktL+nzSXqYeoWh9fr7fkmC0k/07+SHzzfWvOhWWWlRenUVL5mj7FRq+L9\n9kDjChLR3Jr4L6Sj1iaQ+0uqDSQNYSYO9ctMjAVjFiNhiAd+S6B451Q1VbDKTCHt\nkRW9omz6hwKBgBFTsgY6eJorJl77zmG+mMsSb0kqZqJxahrNa/X2GSUyoeelxsIq\nKQWHhERrUkKykJVGpzkllFSNRMSYOIJ5g8ItO82/m2z2Vm66DAzA78aJhZ1TH6Bd\n6c2p6x0tcJU15rs7zKBnuyBoCcRZTxzur9eQXaxDJVBzxYOmrkKig+VfAoGBAMCP\n2Fiehxh5HobsYNmBEuXjHsM0RZiyA0c8LakoPFL8PodUme5PupUw6cNJDJeUUwbQ\nny8vLOK+nMnUKsu6JK5pV/VNsfM3OZU6p5Bf7ylOcEE/sHF1JVWu0CAQO3+3xmx9\n1RPH2mGwHjMhRzPy4jFdP3wi10KgiY+HbLuvEJChAoGAYCsh3UhtTzGUOlPBkmLL\n17bD0wN4J/fOv8BoXPZ8H2CdqVgWy0s+s+QaPqRxNcA6YyGymBqrmQAn1Uii25r9\nKAwVAjg3S2KDEMSI2RbMMmQJSZ1u0GkxqOUC/MMeZqBYTYxVeqcQPoqJZ0Nk7IOA\nZPFif8bVfcZqeimxrFaV6YI=\n-----END PRIVATE KEY-----",
|
||||||
),
|
),
|
||||||
|
@ -382,7 +384,9 @@ class ExposedActorRepositoryTest : AbstractRepositoryTest(Actors) {
|
||||||
inbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/inbox"),
|
inbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/inbox"),
|
||||||
outbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/outbox"),
|
outbox = URI.create("https://test-hideout-dev.usbharu.dev/users/b/outbox"),
|
||||||
uri = URI.create("https://test-hideout-dev.usbharu.dev/users/b"),
|
uri = URI.create("https://test-hideout-dev.usbharu.dev/users/b"),
|
||||||
publicKey = ActorPublicKey("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyuMjzmQBsSxzK6NkOpZh\nWuohaUbzCY7AafXt+3+tiL6LulYNg/YRIqKc7Q/vTJE6CHrqo7RA/OqYrSMxF/LC\nf8aX5aHwJE1A2gSgCcs1IL5GJaYRlp4NcuazpBC9NO4xIrvH//jcVnZGXGWsCbls\nHXZGZdurWOF0Bl3mYN8CdupVumrGuOPs+wbI/Gh+OHw611TcXMyAwFwU2UjvPEgk\nEACW9OvJaq1K40jVCAa3b1nXt53vlXXZEUlL78L0C9xuFbJG0K/GKMBN44GyftJO\nhA95Rf1Nhd0vKDLBiRocGcARmBo9PaSCR5651gJEk5/wfLUnNAf0xj3R8LBoOhnT\nCQIDAQAB\n-----END PUBLIC KEY-----"),
|
publicKey = ActorPublicKey(
|
||||||
|
"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyuMjzmQBsSxzK6NkOpZh\nWuohaUbzCY7AafXt+3+tiL6LulYNg/YRIqKc7Q/vTJE6CHrqo7RA/OqYrSMxF/LC\nf8aX5aHwJE1A2gSgCcs1IL5GJaYRlp4NcuazpBC9NO4xIrvH//jcVnZGXGWsCbls\nHXZGZdurWOF0Bl3mYN8CdupVumrGuOPs+wbI/Gh+OHw611TcXMyAwFwU2UjvPEgk\nEACW9OvJaq1K40jVCAa3b1nXt53vlXXZEUlL78L0C9xuFbJG0K/GKMBN44GyftJO\nhA95Rf1Nhd0vKDLBiRocGcARmBo9PaSCR5651gJEk5/wfLUnNAf0xj3R8LBoOhnT\nCQIDAQAB\n-----END PUBLIC KEY-----"
|
||||||
|
),
|
||||||
privateKey = ActorPrivateKey(
|
privateKey = ActorPrivateKey(
|
||||||
"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDK4yPOZAGxLHMr\no2Q6lmFa6iFpRvMJjsBp9e37f62Ivou6Vg2D9hEiopztD+9MkToIeuqjtED86pit\nIzEX8sJ/xpflofAkTUDaBKAJyzUgvkYlphGWng1y5rOkEL007jEiu8f/+NxWdkZc\nZawJuWwddkZl26tY4XQGXeZg3wJ26lW6asa44+z7Bsj8aH44fDrXVNxczIDAXBTZ\nSO88SCQQAJb068lqrUrjSNUIBrdvWde3ne+VddkRSUvvwvQL3G4VskbQr8YowE3j\ngbJ+0k6ED3lF/U2F3S8oMsGJGhwZwBGYGj09pIJHnrnWAkSTn/B8tSc0B/TGPdHw\nsGg6GdMJAgMBAAECggEAHkEhLEb70kdOGgJLUR9D/5zYBE0eXdz/MsMyd1AH+Shs\n9AmetKsYzWDmuhp9Cp5swyn328Hmn7B+DvInVn+5YvjNhY07SbaJcVls4g5UQFXk\nu6WC4ZfKap7IyAeaUg54858r8677xcWXuByN5dn+1iU2hJGYK3Cx7rx0PRrUURYG\n2BRaEEwkcPNm9u679OOTyvTmA3NhewUuDaTMkZnnAml87uYYnmFKjQcR+S2UqOm6\nvBZ/devG4TfPBeKEAya/ba8JJ8frGOtjmR9EIliTQoxI2izeAfoGs1OsCSpuPy6s\nV5f0X3HYM7CA+Fpkt2pnixuwg96LaVr4OpVxujhNlwKBgQD1827VuKFGrneNO+c+\n4EIvh+vLh462bJiaVsMHfRhNZF1/5i8gfNJ16ST60hJo11E4riHPzi3q6GWuxOYl\nCkVKvhJ2g3mgnhoehcgnT7UBkasaC7JYd+LsFDnWOTVSJOy2OqfLdLDGAuSTN3kO\nBF4p0ZqQ/AouFNin57WNRGVZ7wKBgQDTLUZtfTkOU3G1nIMTRKmZjqdER5glzHCm\n9o/1ZsQktL+nzSXqYeoWh9fr7fkmC0k/07+SHzzfWvOhWWWlRenUVL5mj7FRq+L9\n9kDjChLR3Jr4L6Sj1iaQ+0uqDSQNYSYO9ctMjAVjFiNhiAd+S6B451Q1VbDKTCHt\nkRW9omz6hwKBgBFTsgY6eJorJl77zmG+mMsSb0kqZqJxahrNa/X2GSUyoeelxsIq\nKQWHhERrUkKykJVGpzkllFSNRMSYOIJ5g8ItO82/m2z2Vm66DAzA78aJhZ1TH6Bd\n6c2p6x0tcJU15rs7zKBnuyBoCcRZTxzur9eQXaxDJVBzxYOmrkKig+VfAoGBAMCP\n2Fiehxh5HobsYNmBEuXjHsM0RZiyA0c8LakoPFL8PodUme5PupUw6cNJDJeUUwbQ\nny8vLOK+nMnUKsu6JK5pV/VNsfM3OZU6p5Bf7ylOcEE/sHF1JVWu0CAQO3+3xmx9\n1RPH2mGwHjMhRzPy4jFdP3wi10KgiY+HbLuvEJChAoGAYCsh3UhtTzGUOlPBkmLL\n17bD0wN4J/fOv8BoXPZ8H2CdqVgWy0s+s+QaPqRxNcA6YyGymBqrmQAn1Uii25r9\nKAwVAjg3S2KDEMSI2RbMMmQJSZ1u0GkxqOUC/MMeZqBYTYxVeqcQPoqJZ0Nk7IOA\nZPFif8bVfcZqeimxrFaV6YI=\n-----END PRIVATE KEY-----",
|
"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDK4yPOZAGxLHMr\no2Q6lmFa6iFpRvMJjsBp9e37f62Ivou6Vg2D9hEiopztD+9MkToIeuqjtED86pit\nIzEX8sJ/xpflofAkTUDaBKAJyzUgvkYlphGWng1y5rOkEL007jEiu8f/+NxWdkZc\nZawJuWwddkZl26tY4XQGXeZg3wJ26lW6asa44+z7Bsj8aH44fDrXVNxczIDAXBTZ\nSO88SCQQAJb068lqrUrjSNUIBrdvWde3ne+VddkRSUvvwvQL3G4VskbQr8YowE3j\ngbJ+0k6ED3lF/U2F3S8oMsGJGhwZwBGYGj09pIJHnrnWAkSTn/B8tSc0B/TGPdHw\nsGg6GdMJAgMBAAECggEAHkEhLEb70kdOGgJLUR9D/5zYBE0eXdz/MsMyd1AH+Shs\n9AmetKsYzWDmuhp9Cp5swyn328Hmn7B+DvInVn+5YvjNhY07SbaJcVls4g5UQFXk\nu6WC4ZfKap7IyAeaUg54858r8677xcWXuByN5dn+1iU2hJGYK3Cx7rx0PRrUURYG\n2BRaEEwkcPNm9u679OOTyvTmA3NhewUuDaTMkZnnAml87uYYnmFKjQcR+S2UqOm6\nvBZ/devG4TfPBeKEAya/ba8JJ8frGOtjmR9EIliTQoxI2izeAfoGs1OsCSpuPy6s\nV5f0X3HYM7CA+Fpkt2pnixuwg96LaVr4OpVxujhNlwKBgQD1827VuKFGrneNO+c+\n4EIvh+vLh462bJiaVsMHfRhNZF1/5i8gfNJ16ST60hJo11E4riHPzi3q6GWuxOYl\nCkVKvhJ2g3mgnhoehcgnT7UBkasaC7JYd+LsFDnWOTVSJOy2OqfLdLDGAuSTN3kO\nBF4p0ZqQ/AouFNin57WNRGVZ7wKBgQDTLUZtfTkOU3G1nIMTRKmZjqdER5glzHCm\n9o/1ZsQktL+nzSXqYeoWh9fr7fkmC0k/07+SHzzfWvOhWWWlRenUVL5mj7FRq+L9\n9kDjChLR3Jr4L6Sj1iaQ+0uqDSQNYSYO9ctMjAVjFiNhiAd+S6B451Q1VbDKTCHt\nkRW9omz6hwKBgBFTsgY6eJorJl77zmG+mMsSb0kqZqJxahrNa/X2GSUyoeelxsIq\nKQWHhERrUkKykJVGpzkllFSNRMSYOIJ5g8ItO82/m2z2Vm66DAzA78aJhZ1TH6Bd\n6c2p6x0tcJU15rs7zKBnuyBoCcRZTxzur9eQXaxDJVBzxYOmrkKig+VfAoGBAMCP\n2Fiehxh5HobsYNmBEuXjHsM0RZiyA0c8LakoPFL8PodUme5PupUw6cNJDJeUUwbQ\nny8vLOK+nMnUKsu6JK5pV/VNsfM3OZU6p5Bf7ylOcEE/sHF1JVWu0CAQO3+3xmx9\n1RPH2mGwHjMhRzPy4jFdP3wi10KgiY+HbLuvEJChAoGAYCsh3UhtTzGUOlPBkmLL\n17bD0wN4J/fOv8BoXPZ8H2CdqVgWy0s+s+QaPqRxNcA6YyGymBqrmQAn1Uii25r9\nKAwVAjg3S2KDEMSI2RbMMmQJSZ1u0GkxqOUC/MMeZqBYTYxVeqcQPoqJZ0Nk7IOA\nZPFif8bVfcZqeimxrFaV6YI=\n-----END PRIVATE KEY-----",
|
||||||
),
|
),
|
||||||
|
@ -555,4 +559,4 @@ class ExposedActorRepositoryTest : AbstractRepositoryTest(Actors) {
|
||||||
|
|
||||||
verify(domainEventPublisher, times(1)).publishEvent(any())
|
verify(domainEventPublisher, times(1)).publishEvent(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,5 @@ class ExposedApplicationRepositoryTest : AbstractRepositoryTest(Applications) {
|
||||||
.rowAtStartPoint()
|
.rowAtStartPoint()
|
||||||
.value(Applications.id.name).isEqualTo(application.applicationId.id)
|
.value(Applications.id.name).isEqualTo(application.applicationId.id)
|
||||||
.value(Applications.name.name).isEqualTo(application.name.name)
|
.value(Applications.name.name).isEqualTo(application.name.name)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,6 @@ class ExposedCustomEmojiRepositoryTest : AbstractRepositoryTest(CustomEmojis) {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun delete_削除される() = runTest {
|
fun delete_削除される() = runTest {
|
||||||
|
|
||||||
dbSetup(to = dataSource) {
|
dbSetup(to = dataSource) {
|
||||||
execute(disableReferenceIntegrityConstraints)
|
execute(disableReferenceIntegrityConstraints)
|
||||||
insertInto(CustomEmojis.tableName) {
|
insertInto(CustomEmojis.tableName) {
|
||||||
|
@ -145,7 +144,6 @@ class ExposedCustomEmojiRepositoryTest : AbstractRepositoryTest(CustomEmojis) {
|
||||||
Instant.parse("2020-01-01T00:00:00Z")
|
Instant.parse("2020-01-01T00:00:00Z")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
change.withSuspend {
|
change.withSuspend {
|
||||||
ExposedCustomEmojiRepository().delete(customEmoji)
|
ExposedCustomEmojiRepository().delete(customEmoji)
|
||||||
}
|
}
|
||||||
|
@ -245,7 +243,8 @@ class ExposedCustomEmojiRepositoryTest : AbstractRepositoryTest(CustomEmojis) {
|
||||||
URI.create("https://example.com/1"),
|
URI.create("https://example.com/1"),
|
||||||
null,
|
null,
|
||||||
Instant.parse("2020-01-01T00:00:00Z")
|
Instant.parse("2020-01-01T00:00:00Z")
|
||||||
), CustomEmoji(
|
),
|
||||||
|
CustomEmoji(
|
||||||
CustomEmojiId(2),
|
CustomEmojiId(2),
|
||||||
"emoji2",
|
"emoji2",
|
||||||
Domain("example.com"),
|
Domain("example.com"),
|
||||||
|
@ -306,7 +305,8 @@ class ExposedCustomEmojiRepositoryTest : AbstractRepositoryTest(CustomEmojis) {
|
||||||
URI.create("https://example.com/1"),
|
URI.create("https://example.com/1"),
|
||||||
null,
|
null,
|
||||||
Instant.parse("2020-01-01T00:00:00Z")
|
Instant.parse("2020-01-01T00:00:00Z")
|
||||||
), CustomEmoji(
|
),
|
||||||
|
CustomEmoji(
|
||||||
CustomEmojiId(3),
|
CustomEmojiId(3),
|
||||||
"emoji3",
|
"emoji3",
|
||||||
Domain("example.com"),
|
Domain("example.com"),
|
||||||
|
@ -321,4 +321,4 @@ class ExposedCustomEmojiRepositoryTest : AbstractRepositoryTest(CustomEmojis) {
|
||||||
|
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,8 @@ class ExposedFilterRepositoryTest : AbstractRepositoryTest(Filters) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertEquals(
|
private fun assertEquals(
|
||||||
expected: Filter, actual: Filter?
|
expected: Filter,
|
||||||
|
actual: Filter?
|
||||||
) {
|
) {
|
||||||
kotlin.test.assertEquals(expected, actual)
|
kotlin.test.assertEquals(expected, actual)
|
||||||
assertNotNull(actual)
|
assertNotNull(actual)
|
||||||
|
@ -184,7 +185,6 @@ class ExposedFilterRepositoryTest : AbstractRepositoryTest(Filters) {
|
||||||
assertContentEquals(expected.filterKeywords, actual.filterKeywords.asIterable())
|
assertContentEquals(expected.filterKeywords, actual.filterKeywords.asIterable())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun findByFilterKeywordId_指定された条件で存在しないとnull() = runTest {
|
fun findByFilterKeywordId_指定された条件で存在しないとnull() = runTest {
|
||||||
assertNull(repository.findByFilterKeywordId(FilterKeywordId(1)))
|
assertNull(repository.findByFilterKeywordId(FilterKeywordId(1)))
|
||||||
|
@ -249,11 +249,17 @@ class ExposedFilterRepositoryTest : AbstractRepositoryTest(Filters) {
|
||||||
|
|
||||||
val expected = listOf(
|
val expected = listOf(
|
||||||
Filter(
|
Filter(
|
||||||
FilterId(1), UserDetailId(1), FilterName("name"), setOf(FilterContext.PUBLIC), FilterAction.WARN, setOf(
|
FilterId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
FilterName("name"),
|
||||||
|
setOf(FilterContext.PUBLIC),
|
||||||
|
FilterAction.WARN,
|
||||||
|
setOf(
|
||||||
FilterKeyword(FilterKeywordId(1), FilterKeywordKeyword("keyword"), FilterMode.REGEX),
|
FilterKeyword(FilterKeywordId(1), FilterKeywordKeyword("keyword"), FilterMode.REGEX),
|
||||||
FilterKeyword(FilterKeywordId(3), FilterKeywordKeyword("keyword3"), FilterMode.REGEX)
|
FilterKeyword(FilterKeywordId(3), FilterKeywordKeyword("keyword3"), FilterMode.REGEX)
|
||||||
)
|
)
|
||||||
), Filter(
|
),
|
||||||
|
Filter(
|
||||||
FilterId(2),
|
FilterId(2),
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
FilterName("name2"),
|
FilterName("name2"),
|
||||||
|
@ -262,14 +268,14 @@ class ExposedFilterRepositoryTest : AbstractRepositoryTest(Filters) {
|
||||||
setOf(
|
setOf(
|
||||||
FilterKeyword(FilterKeywordId(2), FilterKeywordKeyword("keyword2"), FilterMode.REGEX)
|
FilterKeyword(FilterKeywordId(2), FilterKeywordKeyword("keyword2"), FilterMode.REGEX)
|
||||||
)
|
)
|
||||||
), Filter(
|
),
|
||||||
|
Filter(
|
||||||
FilterId(3),
|
FilterId(3),
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
FilterName("name3"),
|
FilterName("name3"),
|
||||||
setOf(FilterContext.PUBLIC),
|
setOf(FilterContext.PUBLIC),
|
||||||
FilterAction.HIDE,
|
FilterAction.HIDE,
|
||||||
setOf(
|
setOf()
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -277,4 +283,4 @@ class ExposedFilterRepositoryTest : AbstractRepositoryTest(Filters) {
|
||||||
|
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import dev.usbharu.hideout.core.infrastructure.exposedrepository.Instance as Ins
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||||
class ExposedInstanceRepositoryTest : AbstractRepositoryTest(InstanceTable) {
|
class ExposedInstanceRepositoryTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun save_idが同じレコードがない場合はinsertされる() = runTest {
|
fun save_idが同じレコードがない場合はinsertされる() = runTest {
|
||||||
ExposedInstanceRepository().save(
|
ExposedInstanceRepository().save(
|
||||||
|
@ -77,7 +76,6 @@ class ExposedInstanceRepositoryTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
}
|
}
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
|
|
||||||
ExposedInstanceRepository().save(
|
ExposedInstanceRepository().save(
|
||||||
Instance(
|
Instance(
|
||||||
id = InstanceId(1),
|
id = InstanceId(1),
|
||||||
|
@ -252,7 +250,6 @@ class ExposedInstanceRepositoryTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
.changeOfDeletionOnTable(InstanceTable.tableName)
|
.changeOfDeletionOnTable(InstanceTable.tableName)
|
||||||
.rowAtStartPoint()
|
.rowAtStartPoint()
|
||||||
.value(InstanceTable.id.name).isEqualTo(1)
|
.value(InstanceTable.id.name).isEqualTo(1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -272,4 +269,3 @@ class ExposedInstanceRepositoryTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ import kotlin.test.assertNotNull
|
||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
import dev.usbharu.hideout.core.domain.model.media.Media as EntityMedia
|
import dev.usbharu.hideout.core.domain.model.media.Media as EntityMedia
|
||||||
|
|
||||||
|
|
||||||
class ExposedMediaRepositoryTest : AbstractRepositoryTest(Media) {
|
class ExposedMediaRepositoryTest : AbstractRepositoryTest(Media) {
|
||||||
@Test
|
@Test
|
||||||
fun save_idが同じレコードが存在しないとinsert() = runTest {
|
fun save_idが同じレコードが存在しないとinsert() = runTest {
|
||||||
|
@ -360,4 +359,4 @@ class ExposedMediaRepositoryTest : AbstractRepositoryTest(Media) {
|
||||||
assertThat(actual)
|
assertThat(actual)
|
||||||
.hasSize(2)
|
.hasSize(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,6 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
||||||
assertEquals(expect.mediaIds, actual.mediaIds)
|
assertEquals(expect.mediaIds, actual.mediaIds)
|
||||||
assertEquals(expect.visibleActors, actual.visibleActors)
|
assertEquals(expect.visibleActors, actual.visibleActors)
|
||||||
assertEquals(expect.hide, actual.hide)
|
assertEquals(expect.hide, actual.hide)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -972,7 +971,6 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun saveAll_idがある場合はinsertなければupdateされる() = runTest {
|
fun saveAll_idがある場合はinsertなければupdateされる() = runTest {
|
||||||
|
|
||||||
dbSetup(to = dataSource) {
|
dbSetup(to = dataSource) {
|
||||||
execute(disableReferenceIntegrityConstraints)
|
execute(disableReferenceIntegrityConstraints)
|
||||||
insertInto("public.posts") {
|
insertInto("public.posts") {
|
||||||
|
@ -1152,7 +1150,10 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
||||||
repostId = 1,
|
repostId = 1,
|
||||||
moveTo = 1
|
moveTo = 1
|
||||||
)
|
)
|
||||||
).map { it.checkUpdate();it }
|
).map {
|
||||||
|
it.checkUpdate()
|
||||||
|
it
|
||||||
|
}
|
||||||
|
|
||||||
repository.saveAll(pl)
|
repository.saveAll(pl)
|
||||||
|
|
||||||
|
@ -1185,7 +1186,6 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
||||||
false,
|
false,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
|
@ -1197,4 +1197,4 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
||||||
|
|
||||||
verify(domainEventPublisher, times(1)).publishEvent(any())
|
verify(domainEventPublisher, times(1)).publishEvent(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var domainEventPublisher: DomainEventPublisher
|
lateinit var domainEventPublisher: DomainEventPublisher
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun save_idが同じレコードがなければinsert() = runTest {
|
fun save_idが同じレコードがなければinsert() = runTest {
|
||||||
dbSetup(to = dataSource) {
|
dbSetup(to = dataSource) {
|
||||||
|
@ -231,7 +230,6 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
val actual = repository.findById(ReactionId(1))
|
val actual = repository.findById(ReactionId(1))
|
||||||
|
|
||||||
assertEquals(expected, actual)
|
assertEquals(expected, actual)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertEquals(
|
private fun assertEquals(
|
||||||
|
@ -285,12 +283,16 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
|
|
||||||
val actual1 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
val actual1 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
||||||
PostId(1),
|
PostId(1),
|
||||||
ActorId(1), CustomEmojiId
|
ActorId(1),
|
||||||
(1), "❤"
|
CustomEmojiId
|
||||||
|
(1),
|
||||||
|
"❤"
|
||||||
)
|
)
|
||||||
val actual2 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
val actual2 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
||||||
PostId(3),
|
PostId(3),
|
||||||
ActorId(2), null, "❤"
|
ActorId(2),
|
||||||
|
null,
|
||||||
|
"❤"
|
||||||
)
|
)
|
||||||
|
|
||||||
assertTrue(actual1)
|
assertTrue(actual1)
|
||||||
|
@ -311,12 +313,16 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
|
|
||||||
val actual1 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
val actual1 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
||||||
PostId(3),
|
PostId(3),
|
||||||
ActorId(1), CustomEmojiId
|
ActorId(1),
|
||||||
(1), "❤"
|
CustomEmojiId
|
||||||
|
(1),
|
||||||
|
"❤"
|
||||||
)
|
)
|
||||||
val actual2 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
val actual2 = repository.existsByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
||||||
PostId(2),
|
PostId(2),
|
||||||
ActorId(2), null, "❤"
|
ActorId(2),
|
||||||
|
null,
|
||||||
|
"❤"
|
||||||
)
|
)
|
||||||
|
|
||||||
assertFalse(actual1)
|
assertFalse(actual1)
|
||||||
|
@ -371,8 +377,10 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
val actual =
|
val actual =
|
||||||
repository.findByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
repository.findByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
||||||
PostId(1),
|
PostId(1),
|
||||||
ActorId(1), CustomEmojiId
|
ActorId(1),
|
||||||
(1), "❤"
|
CustomEmojiId
|
||||||
|
(1),
|
||||||
|
"❤"
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(expected, actual)
|
assertEquals(expected, actual)
|
||||||
|
@ -383,8 +391,10 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
assertNull(
|
assertNull(
|
||||||
repository.findByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
repository.findByPostIdAndActorIdAndCustomEmojiIdOrUnicodeEmoji(
|
||||||
PostId(1),
|
PostId(1),
|
||||||
ActorId(1), CustomEmojiId
|
ActorId(1),
|
||||||
(1), "❤"
|
CustomEmojiId
|
||||||
|
(1),
|
||||||
|
"❤"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -397,9 +407,13 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
repository.save(
|
repository.save(
|
||||||
Reaction.create(
|
Reaction.create(
|
||||||
ReactionId(1),
|
ReactionId(1),
|
||||||
PostId(1), ActorId
|
PostId(1),
|
||||||
(1), CustomEmojiId
|
ActorId
|
||||||
(1), UnicodeEmoji("❤"), Instant.now
|
(1),
|
||||||
|
CustomEmojiId
|
||||||
|
(1),
|
||||||
|
UnicodeEmoji("❤"),
|
||||||
|
Instant.now
|
||||||
()
|
()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -423,9 +437,13 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
|
|
||||||
val reaction = Reaction(
|
val reaction = Reaction(
|
||||||
ReactionId(1),
|
ReactionId(1),
|
||||||
PostId(1), ActorId
|
PostId(1),
|
||||||
(1), CustomEmojiId
|
ActorId
|
||||||
(1), UnicodeEmoji("❤"), Instant.now
|
(1),
|
||||||
|
CustomEmojiId
|
||||||
|
(1),
|
||||||
|
UnicodeEmoji("❤"),
|
||||||
|
Instant.now
|
||||||
()
|
()
|
||||||
)
|
)
|
||||||
reaction.delete()
|
reaction.delete()
|
||||||
|
@ -437,4 +455,4 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
||||||
|
|
||||||
verify(domainEventPublisher, times(1)).publishEvent(any())
|
verify(domainEventPublisher, times(1)).publishEvent(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,8 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val relationship = Relationship.default(
|
val relationship = Relationship.default(
|
||||||
ActorId(1), ActorId(2)
|
ActorId(1),
|
||||||
|
ActorId(2)
|
||||||
)
|
)
|
||||||
|
|
||||||
repository.save(relationship)
|
repository.save(relationship)
|
||||||
|
@ -280,7 +281,8 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val relationship = Relationship.default(
|
val relationship = Relationship.default(
|
||||||
ActorId(1), ActorId(2)
|
ActorId(1),
|
||||||
|
ActorId(2)
|
||||||
)
|
)
|
||||||
|
|
||||||
change.withSuspend {
|
change.withSuspend {
|
||||||
|
@ -292,7 +294,6 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
.rowAtStartPoint()
|
.rowAtStartPoint()
|
||||||
.value(Relationships.actorId.name).isEqualTo(relationship.actorId.id)
|
.value(Relationships.actorId.name).isEqualTo(relationship.actorId.id)
|
||||||
.value(Relationships.targetActorId.name).isEqualTo(relationship.targetActorId.id)
|
.value(Relationships.targetActorId.name).isEqualTo(relationship.targetActorId.id)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -364,7 +365,9 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
)
|
)
|
||||||
|
|
||||||
val actual = repository.findByActorIdsAndTargetIdAndBlocking(
|
val actual = repository.findByActorIdsAndTargetIdAndBlocking(
|
||||||
listOf(ActorId(1), ActorId(4)), ActorId(3), blocking = true
|
listOf(ActorId(1), ActorId(4)),
|
||||||
|
ActorId(3),
|
||||||
|
blocking = true
|
||||||
)
|
)
|
||||||
|
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
|
@ -382,7 +385,9 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
)
|
)
|
||||||
|
|
||||||
val actual2 = repository.findByActorIdsAndTargetIdAndBlocking(
|
val actual2 = repository.findByActorIdsAndTargetIdAndBlocking(
|
||||||
listOf(ActorId(1), ActorId(4)), ActorId(3), blocking = false
|
listOf(ActorId(1), ActorId(4)),
|
||||||
|
ActorId(3),
|
||||||
|
blocking = false
|
||||||
)
|
)
|
||||||
|
|
||||||
assertContentEquals(expected2, actual2)
|
assertContentEquals(expected2, actual2)
|
||||||
|
@ -412,7 +417,8 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
muting = true,
|
muting = true,
|
||||||
followRequesting = true,
|
followRequesting = true,
|
||||||
mutingFollowRequest = false
|
mutingFollowRequest = false
|
||||||
), Relationship(
|
),
|
||||||
|
Relationship(
|
||||||
actorId = ActorId(1),
|
actorId = ActorId(1),
|
||||||
targetActorId = ActorId(4),
|
targetActorId = ActorId(4),
|
||||||
following = false,
|
following = false,
|
||||||
|
@ -424,7 +430,9 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
)
|
)
|
||||||
|
|
||||||
val actual = repository.findByActorIdAndTargetIdsAndFollowing(
|
val actual = repository.findByActorIdAndTargetIdsAndFollowing(
|
||||||
ActorId(1), listOf(ActorId(2), ActorId(3), ActorId(4)), following = true
|
ActorId(1),
|
||||||
|
listOf(ActorId(2), ActorId(3), ActorId(4)),
|
||||||
|
following = true
|
||||||
)
|
)
|
||||||
|
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
|
@ -442,7 +450,9 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
)
|
)
|
||||||
|
|
||||||
val actual2 = repository.findByActorIdAndTargetIdsAndFollowing(
|
val actual2 = repository.findByActorIdAndTargetIdsAndFollowing(
|
||||||
ActorId(1), listOf(ActorId(2), ActorId(3), ActorId(4)), following = false
|
ActorId(1),
|
||||||
|
listOf(ActorId(2), ActorId(3), ActorId(4)),
|
||||||
|
following = false
|
||||||
)
|
)
|
||||||
|
|
||||||
assertContentEquals(expected2, actual2)
|
assertContentEquals(expected2, actual2)
|
||||||
|
@ -500,4 +510,4 @@ class ExposedRelationshipRepositoryTest : AbstractRepositoryTest(Relationships)
|
||||||
|
|
||||||
verify(domainEventPublisher, times(1)).publishEvent(any())
|
verify(domainEventPublisher, times(1)).publishEvent(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,10 @@ class ExposedTimelineRelationshipRepositoryTest : AbstractRepositoryTest(Timelin
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val relationship = TimelineRelationship(
|
val relationship = TimelineRelationship(
|
||||||
TimelineRelationshipId(1), TimelineId(1), ActorId(1), Visible.PUBLIC
|
TimelineRelationshipId(1),
|
||||||
|
TimelineId(1),
|
||||||
|
ActorId(1),
|
||||||
|
Visible.PUBLIC
|
||||||
)
|
)
|
||||||
ExposedTimelineRelationshipRepository().save(relationship)
|
ExposedTimelineRelationshipRepository().save(relationship)
|
||||||
|
|
||||||
|
@ -125,7 +128,10 @@ class ExposedTimelineRelationshipRepositoryTest : AbstractRepositoryTest(Timelin
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val relationship = TimelineRelationship(
|
val relationship = TimelineRelationship(
|
||||||
TimelineRelationshipId(1), TimelineId(1), ActorId(1), Visible.PUBLIC
|
TimelineRelationshipId(1),
|
||||||
|
TimelineId(1),
|
||||||
|
ActorId(1),
|
||||||
|
Visible.PUBLIC
|
||||||
)
|
)
|
||||||
ExposedTimelineRelationshipRepository().save(relationship)
|
ExposedTimelineRelationshipRepository().save(relationship)
|
||||||
|
|
||||||
|
@ -150,8 +156,10 @@ class ExposedTimelineRelationshipRepositoryTest : AbstractRepositoryTest(Timelin
|
||||||
|
|
||||||
val timelineRelationship = TimelineRelationship(
|
val timelineRelationship = TimelineRelationship(
|
||||||
TimelineRelationshipId(1),
|
TimelineRelationshipId(1),
|
||||||
TimelineId(1), ActorId
|
TimelineId(1),
|
||||||
(3), Visible.PUBLIC
|
ActorId
|
||||||
|
(3),
|
||||||
|
Visible.PUBLIC
|
||||||
)
|
)
|
||||||
|
|
||||||
change.withSuspend {
|
change.withSuspend {
|
||||||
|
@ -177,7 +185,6 @@ class ExposedTimelineRelationshipRepositoryTest : AbstractRepositoryTest(Timelin
|
||||||
execute(enableReferenceIntegrityConstraints)
|
execute(enableReferenceIntegrityConstraints)
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
|
|
||||||
val findByActorId = ExposedTimelineRelationshipRepository().findByActorId(actorId = ActorId(3))
|
val findByActorId = ExposedTimelineRelationshipRepository().findByActorId(actorId = ActorId(3))
|
||||||
|
|
||||||
assertThat(findByActorId)
|
assertThat(findByActorId)
|
||||||
|
@ -251,4 +258,4 @@ class ExposedTimelineRelationshipRepositoryTest : AbstractRepositoryTest(Timelin
|
||||||
fun findByTimelineIdAndActorId_指定された条件で存在しないとnull() = runTest {
|
fun findByTimelineIdAndActorId_指定された条件で存在しないとnull() = runTest {
|
||||||
ExposedTimelineRelationshipRepository().findByTimelineIdAndActorId(TimelineId(1), ActorId(1))
|
ExposedTimelineRelationshipRepository().findByTimelineIdAndActorId(TimelineId(1), ActorId(1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,6 @@ class ExposedTimelineRepositoryTest : AbstractRepositoryTest(Timelines) {
|
||||||
columns(Timelines.columns)
|
columns(Timelines.columns)
|
||||||
values(1, 1, "test-timeline", "PUBLIC", true)
|
values(1, 1, "test-timeline", "PUBLIC", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
}.launch()
|
}.launch()
|
||||||
val timeline = Timeline(
|
val timeline = Timeline(
|
||||||
id = TimelineId(1),
|
id = TimelineId(1),
|
||||||
|
@ -100,7 +99,6 @@ class ExposedTimelineRepositoryTest : AbstractRepositoryTest(Timelines) {
|
||||||
columns(Timelines.columns)
|
columns(Timelines.columns)
|
||||||
values(1, 1, "test-timeline", "PUBLIC", true)
|
values(1, 1, "test-timeline", "PUBLIC", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
}.launch()
|
}.launch()
|
||||||
val timeline = Timeline(
|
val timeline = Timeline(
|
||||||
id = TimelineId(1),
|
id = TimelineId(1),
|
||||||
|
@ -150,7 +148,11 @@ class ExposedTimelineRepositoryTest : AbstractRepositoryTest(Timelines) {
|
||||||
val actual = repository.findById(TimelineId(1))
|
val actual = repository.findById(TimelineId(1))
|
||||||
|
|
||||||
val expected = Timeline(
|
val expected = Timeline(
|
||||||
TimelineId(1), UserDetailId(1), TimelineName("test-timeline"), TimelineVisibility.PUBLIC, true
|
TimelineId(1),
|
||||||
|
UserDetailId(1),
|
||||||
|
TimelineName("test-timeline"),
|
||||||
|
TimelineVisibility.PUBLIC,
|
||||||
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(expected, actual)
|
assertEquals(expected, actual)
|
||||||
|
@ -199,8 +201,10 @@ class ExposedTimelineRepositoryTest : AbstractRepositoryTest(Timelines) {
|
||||||
)
|
)
|
||||||
|
|
||||||
timeline.setVisibility(
|
timeline.setVisibility(
|
||||||
TimelineVisibility.PUBLIC, UserDetail.create(
|
TimelineVisibility.PUBLIC,
|
||||||
UserDetailId(1), ActorId(1),
|
UserDetail.create(
|
||||||
|
UserDetailId(1),
|
||||||
|
ActorId(1),
|
||||||
UserDetailHashedPassword("aaaaaa"),
|
UserDetailHashedPassword("aaaaaa"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -224,7 +228,6 @@ class ExposedTimelineRepositoryTest : AbstractRepositoryTest(Timelines) {
|
||||||
columns(Timelines.columns)
|
columns(Timelines.columns)
|
||||||
values(1, 1, "test-timeline", "PUBLIC", true)
|
values(1, 1, "test-timeline", "PUBLIC", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
}.launch()
|
}.launch()
|
||||||
val timeline = Timeline(
|
val timeline = Timeline(
|
||||||
id = TimelineId(1),
|
id = TimelineId(1),
|
||||||
|
@ -235,8 +238,10 @@ class ExposedTimelineRepositoryTest : AbstractRepositoryTest(Timelines) {
|
||||||
)
|
)
|
||||||
|
|
||||||
timeline.setVisibility(
|
timeline.setVisibility(
|
||||||
TimelineVisibility.PUBLIC, UserDetail.create(
|
TimelineVisibility.PUBLIC,
|
||||||
UserDetailId(1), ActorId(1),
|
UserDetail.create(
|
||||||
|
UserDetailId(1),
|
||||||
|
ActorId(1),
|
||||||
UserDetailHashedPassword("aaaaaa"),
|
UserDetailHashedPassword("aaaaaa"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -175,7 +175,12 @@ class ExposedUserDetailRepositoryTest : AbstractRepositoryTest(UserDetails) {
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val userDetail = UserDetail(
|
val userDetail = UserDetail(
|
||||||
UserDetailId(1), ActorId(1), UserDetailHashedPassword("VeeeeeeeeeeeeeryStrongPassword"), false, null, null
|
UserDetailId(1),
|
||||||
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("VeeeeeeeeeeeeeryStrongPassword"),
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null
|
||||||
)
|
)
|
||||||
|
|
||||||
change.withSuspend {
|
change.withSuspend {
|
||||||
|
@ -267,7 +272,12 @@ class ExposedUserDetailRepositoryTest : AbstractRepositoryTest(UserDetails) {
|
||||||
insertInto("public.user_details") {
|
insertInto("public.user_details") {
|
||||||
columns(UserDetails.columns)
|
columns(UserDetails.columns)
|
||||||
values(
|
values(
|
||||||
1, 1, "$2a$10\$EBj3lstVOv0wz3CxLpzYJu8FFrUJ2MPJW9Vlklyg.bfGEOn5sqIwm", false, null, null
|
1,
|
||||||
|
1,
|
||||||
|
"$2a$10\$EBj3lstVOv0wz3CxLpzYJu8FFrUJ2MPJW9Vlklyg.bfGEOn5sqIwm",
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null
|
||||||
)
|
)
|
||||||
values(
|
values(
|
||||||
2,
|
2,
|
||||||
|
@ -353,7 +363,8 @@ class ExposedUserDetailRepositoryTest : AbstractRepositoryTest(UserDetails) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertEquals(
|
private fun assertEquals(
|
||||||
actual: UserDetail?, expect: UserDetail
|
actual: UserDetail?,
|
||||||
|
expect: UserDetail
|
||||||
) {
|
) {
|
||||||
assertNotNull(actual)
|
assertNotNull(actual)
|
||||||
kotlin.test.assertEquals(expect, actual)
|
kotlin.test.assertEquals(expect, actual)
|
||||||
|
|
|
@ -72,4 +72,4 @@ class DefaultPostContentFormatterTest {
|
||||||
|
|
||||||
assertEquals(FormattedPostContent("<p><a href=\"https://example.com\">a</a></p>", "a"), actual)
|
assertEquals(FormattedPostContent("<p><a href=\"https://example.com\">a</a></p>", "a"), actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.junit.jupiter.api.Test
|
||||||
class TwitterSnowflakeIdGenerateServiceTest {
|
class TwitterSnowflakeIdGenerateServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun noDuplicateTest() = runBlocking {
|
fun noDuplicateTest() = runBlocking {
|
||||||
|
|
||||||
val mutableListOf = coroutineScope {
|
val mutableListOf = coroutineScope {
|
||||||
(1..10000).map {
|
(1..10000).map {
|
||||||
async {
|
async {
|
||||||
|
@ -21,4 +20,4 @@ class TwitterSnowflakeIdGenerateServiceTest {
|
||||||
|
|
||||||
assertEquals(0, mutableListOf.size - mutableListOf.toSet().size)
|
assertEquals(0, mutableListOf.size - mutableListOf.toSet().size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,8 @@ class UserDetailsServiceImplTest {
|
||||||
fun userDetailが見つからない場合失敗() = runTest {
|
fun userDetailが見つからない場合失敗() = runTest {
|
||||||
whenever(actorRepository.findByNameAndDomain(eq("test"), eq("example.com"))).doReturn(
|
whenever(actorRepository.findByNameAndDomain(eq("test"), eq("example.com"))).doReturn(
|
||||||
TestActorFactory.create(
|
TestActorFactory.create(
|
||||||
id = 1, actorName = "test"
|
id = 1,
|
||||||
|
actorName = "test"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
assertThrows<UsernameNotFoundException> {
|
assertThrows<UsernameNotFoundException> {
|
||||||
|
@ -80,7 +81,8 @@ class UserDetailsServiceImplTest {
|
||||||
whenever(userDetailRepository.findByActorId(eq(1))).doReturn(
|
whenever(userDetailRepository.findByActorId(eq(1))).doReturn(
|
||||||
UserDetail.create(
|
UserDetail.create(
|
||||||
UserDetailId(1),
|
UserDetailId(1),
|
||||||
ActorId(1), UserDetailHashedPassword("")
|
ActorId(1),
|
||||||
|
UserDetailHashedPassword("")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -88,4 +90,4 @@ class UserDetailsServiceImplTest {
|
||||||
|
|
||||||
assertEquals(HideoutUserDetails(HashSet(), "", "test-1", 1), actual)
|
assertEquals(HideoutUserDetails(HashSet(), "", "test-1", 1), actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,8 @@ class DefaultTimelineStoreTest {
|
||||||
|
|
||||||
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
||||||
FilteredPost(
|
FilteredPost(
|
||||||
post, listOf(
|
post,
|
||||||
|
listOf(
|
||||||
FilterResult(filters.first(), "aaa")
|
FilterResult(filters.first(), "aaa")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -331,7 +332,8 @@ class DefaultTimelineStoreTest {
|
||||||
|
|
||||||
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
||||||
FilteredPost(
|
FilteredPost(
|
||||||
post, listOf(
|
post,
|
||||||
|
listOf(
|
||||||
FilterResult(filters.first(), "aaa")
|
FilterResult(filters.first(), "aaa")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -404,7 +406,8 @@ class DefaultTimelineStoreTest {
|
||||||
|
|
||||||
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
||||||
FilteredPost(
|
FilteredPost(
|
||||||
post, listOf(
|
post,
|
||||||
|
listOf(
|
||||||
FilterResult(filters.first(), "aaa")
|
FilterResult(filters.first(), "aaa")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -477,7 +480,8 @@ class DefaultTimelineStoreTest {
|
||||||
|
|
||||||
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
whenever(filterDomainService.apply(post, FilterContext.HOME, filters)).doReturn(
|
||||||
FilteredPost(
|
FilteredPost(
|
||||||
post, listOf(
|
post,
|
||||||
|
listOf(
|
||||||
FilterResult(filters.first(), "aaa")
|
FilterResult(filters.first(), "aaa")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -503,4 +507,4 @@ class DefaultTimelineStoreTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,12 +69,13 @@ abstract class AbstractRepositoryTest(private val exposedTable: org.jetbrains.ex
|
||||||
hikariConfig.transactionIsolation = "TRANSACTION_READ_UNCOMMITTED"
|
hikariConfig.transactionIsolation = "TRANSACTION_READ_UNCOMMITTED"
|
||||||
dataSource = HikariDataSource(hikariConfig)
|
dataSource = HikariDataSource(hikariConfig)
|
||||||
|
|
||||||
|
|
||||||
flyway = Flyway.configure().cleanDisabled(false).dataSource(dataSource).load()
|
flyway = Flyway.configure().cleanDisabled(false).dataSource(dataSource).load()
|
||||||
Database.connect(dataSource, databaseConfig = DatabaseConfig {
|
Database.connect(
|
||||||
defaultMaxAttempts = 1
|
dataSource,
|
||||||
|
databaseConfig = DatabaseConfig {
|
||||||
})
|
defaultMaxAttempts = 1
|
||||||
|
}
|
||||||
|
)
|
||||||
flyway.clean()
|
flyway.clean()
|
||||||
flyway.migrate()
|
flyway.migrate()
|
||||||
}
|
}
|
||||||
|
@ -121,4 +122,4 @@ suspend fun Changes.withSuspend(block: suspend () -> Unit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val disableReferenceIntegrityConstraints = Operations.sql("SET REFERENTIAL_INTEGRITY FALSE")
|
val disableReferenceIntegrityConstraints = Operations.sql("SET REFERENTIAL_INTEGRITY FALSE")
|
||||||
val enableReferenceIntegrityConstraints = Operations.sql("SET REFERENTIAL_INTEGRITY TRUE")
|
val enableReferenceIntegrityConstraints = Operations.sql("SET REFERENTIAL_INTEGRITY TRUE")
|
||||||
|
|
|
@ -32,4 +32,4 @@ object AssertDomainEvent {
|
||||||
throw AssertionError("Domain Event found")
|
throw AssertionError("Domain Event found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,9 @@ class SpringAccountApi(
|
||||||
override suspend fun apiV1AccountsPost(accountsCreateRequest: AccountsCreateRequest): ResponseEntity<Unit> =
|
override suspend fun apiV1AccountsPost(accountsCreateRequest: AccountsCreateRequest): ResponseEntity<Unit> =
|
||||||
super.apiV1AccountsPost(accountsCreateRequest)
|
super.apiV1AccountsPost(accountsCreateRequest)
|
||||||
|
|
||||||
override suspend fun apiV1AccountsUpdateCredentialsPatch(updateCredentials: UpdateCredentials?): ResponseEntity<Account> =
|
override suspend fun apiV1AccountsUpdateCredentialsPatch(
|
||||||
|
updateCredentials: UpdateCredentials?
|
||||||
|
): ResponseEntity<Account> =
|
||||||
super.apiV1AccountsUpdateCredentialsPatch(updateCredentials)
|
super.apiV1AccountsUpdateCredentialsPatch(updateCredentials)
|
||||||
|
|
||||||
override suspend fun apiV1AccountsVerifyCredentialsGet(): ResponseEntity<CredentialAccount> {
|
override suspend fun apiV1AccountsVerifyCredentialsGet(): ResponseEntity<CredentialAccount> {
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.springframework.boot.test.context.SpringBootTest
|
||||||
import org.springframework.test.context.jdbc.Sql
|
import org.springframework.test.context.jdbc.Sql
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
|
||||||
|
|
||||||
@Sql("/sql/actors.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
|
@Sql("/sql/actors.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
|
||||||
@Sql("/sql/relationships.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
|
@Sql("/sql/relationships.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -41,4 +40,4 @@ class StatusQueryServiceImplTest {
|
||||||
flyway.migrate()
|
flyway.migrate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,6 @@ class AccountApiPaginationTest {
|
||||||
|
|
||||||
val value = jacksonObjectMapper().readValue(content, object : TypeReference<List<Status>>() {})
|
val value = jacksonObjectMapper().readValue(content, object : TypeReference<List<Status>>() {})
|
||||||
|
|
||||||
|
|
||||||
assertThat(value).isEmpty()
|
assertThat(value).isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,4 +177,4 @@ class AccountApiPaginationTest {
|
||||||
flyway.migrate()
|
flyway.migrate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,11 +293,9 @@ class AccountApiTest {
|
||||||
.asyncDispatch()
|
.asyncDispatch()
|
||||||
.andExpect { status { isOk() } }
|
.andExpect { status { isOk() } }
|
||||||
|
|
||||||
|
|
||||||
val alreadyFollow =
|
val alreadyFollow =
|
||||||
relationshipRepository.findByActorIdAndTargetId(ActorId(3733363), ActorId(37335363))?.following
|
relationshipRepository.findByActorIdAndTargetId(ActorId(3733363), ActorId(37335363))?.following
|
||||||
|
|
||||||
|
|
||||||
assertThat(alreadyFollow).isTrue()
|
assertThat(alreadyFollow).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ class AppTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
lateinit var jdbcOperations: JdbcOperations
|
lateinit var jdbcOperations: JdbcOperations
|
||||||
|
|
||||||
|
|
||||||
val registeredClientRepository: JdbcRegisteredClientRepository by lazy {
|
val registeredClientRepository: JdbcRegisteredClientRepository by lazy {
|
||||||
JdbcRegisteredClientRepository(
|
JdbcRegisteredClientRepository(
|
||||||
jdbcOperations
|
jdbcOperations
|
||||||
|
@ -85,7 +84,6 @@ class AppTest {
|
||||||
|
|
||||||
val clientId = objectMapper().readTree(contentAsString)["client_id"].asText()
|
val clientId = objectMapper().readTree(contentAsString)["client_id"].asText()
|
||||||
|
|
||||||
|
|
||||||
val registeredClient = registeredClientRepository.findByClientId(clientId)
|
val registeredClient = registeredClientRepository.findByClientId(clientId)
|
||||||
|
|
||||||
assertNotNull(registeredClient)
|
assertNotNull(registeredClient)
|
||||||
|
@ -115,7 +113,6 @@ class AppTest {
|
||||||
|
|
||||||
val clientId = objectMapper().readTree(contentAsString)["client_id"].asText()
|
val clientId = objectMapper().readTree(contentAsString)["client_id"].asText()
|
||||||
|
|
||||||
|
|
||||||
val registeredClient = registeredClientRepository.findByClientId(clientId)
|
val registeredClient = registeredClientRepository.findByClientId(clientId)
|
||||||
|
|
||||||
assertNotNull(registeredClient)
|
assertNotNull(registeredClient)
|
||||||
|
|
|
@ -217,7 +217,6 @@ class FilterTest {
|
||||||
.andExpect { status { isOk() } }
|
.andExpect { status { isOk() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `apiV2FiltersIdGet read_filters権限で取得できる`() {
|
fun `apiV2FiltersIdGet read_filters権限で取得できる`() {
|
||||||
mockMvc
|
mockMvc
|
||||||
|
@ -713,4 +712,4 @@ class FilterTest {
|
||||||
flyway.migrate()
|
flyway.migrate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,11 +57,8 @@ class MediaTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun メディアをアップロードできる() = runTest {
|
fun メディアをアップロードできる() = runTest {
|
||||||
|
|
||||||
|
|
||||||
mockMvc
|
mockMvc
|
||||||
.multipart("/api/v1/media") {
|
.multipart("/api/v1/media") {
|
||||||
|
|
||||||
file(
|
file(
|
||||||
MockMultipartFile(
|
MockMultipartFile(
|
||||||
"file",
|
"file",
|
||||||
|
@ -78,11 +75,8 @@ class MediaTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun write_mediaスコープでメディアをアップロードできる() = runTest {
|
fun write_mediaスコープでメディアをアップロードできる() = runTest {
|
||||||
|
|
||||||
|
|
||||||
mockMvc
|
mockMvc
|
||||||
.multipart("/api/v1/media") {
|
.multipart("/api/v1/media") {
|
||||||
|
|
||||||
file(
|
file(
|
||||||
MockMultipartFile(
|
MockMultipartFile(
|
||||||
"file",
|
"file",
|
||||||
|
@ -99,11 +93,8 @@ class MediaTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun 権限がないと403() = runTest {
|
fun 権限がないと403() = runTest {
|
||||||
|
|
||||||
|
|
||||||
mockMvc
|
mockMvc
|
||||||
.multipart("/api/v1/media") {
|
.multipart("/api/v1/media") {
|
||||||
|
|
||||||
file(
|
file(
|
||||||
MockMultipartFile(
|
MockMultipartFile(
|
||||||
"file",
|
"file",
|
||||||
|
@ -125,5 +116,4 @@ class MediaTest {
|
||||||
flyway.migrate()
|
flyway.migrate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,12 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
import org.springframework.web.context.WebApplicationContext
|
import org.springframework.web.context.WebApplicationContext
|
||||||
|
|
||||||
|
// @Sql("/sql/notification/test-notifications.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
||||||
|
// @Sql("/sql/notification/test-mastodon_notifications.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
||||||
@SpringBootTest(classes = [SpringApplication::class], properties = ["hideout.use-mongodb=false"])
|
@SpringBootTest(classes = [SpringApplication::class], properties = ["hideout.use-mongodb=false"])
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@Transactional
|
@Transactional
|
||||||
@Sql("/sql/actors.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
@Sql("/sql/actors.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
||||||
//@Sql("/sql/notification/test-notifications.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
|
||||||
//@Sql("/sql/notification/test-mastodon_notifications.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
|
||||||
class ExposedNotificationsApiPaginationTest {
|
class ExposedNotificationsApiPaginationTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private lateinit var context: WebApplicationContext
|
private lateinit var context: WebApplicationContext
|
||||||
|
@ -106,7 +106,6 @@ class ExposedNotificationsApiPaginationTest {
|
||||||
|
|
||||||
assertThat(value.first().id).isEqualTo("25")
|
assertThat(value.first().id).isEqualTo("25")
|
||||||
assertThat(value.last().id).isEqualTo("1")
|
assertThat(value.last().id).isEqualTo("1")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -176,4 +175,4 @@ class ExposedNotificationsApiPaginationTest {
|
||||||
flyway.migrate()
|
flyway.migrate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,11 +40,11 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
import org.springframework.web.context.WebApplicationContext
|
import org.springframework.web.context.WebApplicationContext
|
||||||
|
|
||||||
|
// @Sql("/sql/notification/test-notifications.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
||||||
@SpringBootTest(classes = [SpringApplication::class], properties = ["hideout.use-mongodb=true"])
|
@SpringBootTest(classes = [SpringApplication::class], properties = ["hideout.use-mongodb=true"])
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@Transactional
|
@Transactional
|
||||||
@Sql("/sql/actors.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
@Sql("/sql/actors.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
||||||
//@Sql("/sql/notification/test-notifications.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASS)
|
|
||||||
class MongodbNotificationsApiPaginationTest {
|
class MongodbNotificationsApiPaginationTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private lateinit var context: WebApplicationContext
|
private lateinit var context: WebApplicationContext
|
||||||
|
@ -106,7 +106,6 @@ class MongodbNotificationsApiPaginationTest {
|
||||||
|
|
||||||
Assertions.assertThat(value.first().id).isEqualTo("25")
|
Assertions.assertThat(value.first().id).isEqualTo("25")
|
||||||
Assertions.assertThat(value.last().id).isEqualTo("1")
|
Assertions.assertThat(value.last().id).isEqualTo("1")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -176,4 +175,4 @@ class MongodbNotificationsApiPaginationTest {
|
||||||
flyway.migrate()
|
flyway.migrate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,6 @@ class StatusTest {
|
||||||
|
|
||||||
private lateinit var mockMvc: MockMvc
|
private lateinit var mockMvc: MockMvc
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
mockMvc = MockMvcBuilders.webAppContextSetup(context)
|
mockMvc = MockMvcBuilders.webAppContextSetup(context)
|
||||||
|
@ -218,7 +217,6 @@ class StatusTest {
|
||||||
Reactions.leftJoin(CustomEmojis).selectAll().where { Reactions.postId eq 1 and (Reactions.actorId eq 1) }
|
Reactions.leftJoin(CustomEmojis).selectAll().where { Reactions.postId eq 1 and (Reactions.actorId eq 1) }
|
||||||
.single()
|
.single()
|
||||||
.toReaction()
|
.toReaction()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -5,4 +5,4 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
|
|
||||||
fun objectMapper(): ObjectMapper {
|
fun objectMapper(): ObjectMapper {
|
||||||
return jacksonObjectMapper()
|
return jacksonObjectMapper()
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ package util
|
||||||
|
|
||||||
import dev.usbharu.hideout.core.application.shared.Transaction
|
import dev.usbharu.hideout.core.application.shared.Transaction
|
||||||
|
|
||||||
|
|
||||||
object TestTransaction : Transaction {
|
object TestTransaction : Transaction {
|
||||||
override suspend fun <T> transaction(block: suspend () -> T): T = block()
|
override suspend fun <T> transaction(block: suspend () -> T): T = block()
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,16 @@
|
||||||
|
|
||||||
package util
|
package util
|
||||||
|
|
||||||
//@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
|
// @Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
|
||||||
//@Retention(AnnotationRetention.RUNTIME)
|
// @Retention(AnnotationRetention.RUNTIME)
|
||||||
//@Inherited
|
// @Inherited
|
||||||
//@MustBeDocumented
|
// @MustBeDocumented
|
||||||
//@WithSecurityContext(factory = WithHttpSignatureSecurityContextFactory::class)
|
// @WithSecurityContext(factory = WithHttpSignatureSecurityContextFactory::class)
|
||||||
//annotation class WithHttpSignature(
|
// annotation class WithHttpSignature(
|
||||||
// @get:AliasFor(
|
// @get:AliasFor(
|
||||||
// annotation = WithSecurityContext::class
|
// annotation = WithSecurityContext::class
|
||||||
// ) val setupBefore: TestExecutionEvent = TestExecutionEvent.TEST_METHOD,
|
// ) val setupBefore: TestExecutionEvent = TestExecutionEvent.TEST_METHOD,
|
||||||
// val keyId: String = "https://example.com/users/test-user#pubkey",
|
// val keyId: String = "https://example.com/users/test-user#pubkey",
|
||||||
// val url: String = "https://example.com/inbox",
|
// val url: String = "https://example.com/inbox",
|
||||||
// val method: String = "GET"
|
// val method: String = "GET"
|
||||||
//)
|
// )
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
|
|
||||||
package util
|
package util
|
||||||
|
|
||||||
//class WithHttpSignatureSecurityContextFactory(
|
// class WithHttpSignatureSecurityContextFactory(
|
||||||
// private val actorRepository: ActorRepository,
|
// private val actorRepository: ActorRepository,
|
||||||
// private val transaction: Transaction
|
// private val transaction: Transaction
|
||||||
//) : WithSecurityContextFactory<WithHttpSignature> {
|
// ) : WithSecurityContextFactory<WithHttpSignature> {
|
||||||
//
|
//
|
||||||
// private val securityContextStrategy = SecurityContextHolder.getContextHolderStrategy()
|
// private val securityContextStrategy = SecurityContextHolder.getContextHolderStrategy()
|
||||||
//
|
//
|
||||||
|
@ -49,4 +49,4 @@ package util
|
||||||
// return@runBlocking emptyContext
|
// return@runBlocking emptyContext
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//}
|
// }
|
||||||
|
|
|
@ -17,12 +17,12 @@
|
||||||
package util
|
package util
|
||||||
|
|
||||||
//
|
//
|
||||||
//@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
|
// @Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
|
||||||
//@Retention(AnnotationRetention.RUNTIME)
|
// @Retention(AnnotationRetention.RUNTIME)
|
||||||
//@Inherited
|
// @Inherited
|
||||||
//@MustBeDocumented
|
// @MustBeDocumented
|
||||||
//@WithSecurityContext(factory = WithMockHttpSignatureSecurityContextFactory::class)
|
// @WithSecurityContext(factory = WithMockHttpSignatureSecurityContextFactory::class)
|
||||||
//annotation class WithMockHttpSignature(
|
// annotation class WithMockHttpSignature(
|
||||||
// @get:AliasFor(
|
// @get:AliasFor(
|
||||||
// annotation = WithSecurityContext::class
|
// annotation = WithSecurityContext::class
|
||||||
// ) val setupBefore: TestExecutionEvent = TestExecutionEvent.TEST_METHOD,
|
// ) val setupBefore: TestExecutionEvent = TestExecutionEvent.TEST_METHOD,
|
||||||
|
@ -32,4 +32,4 @@ package util
|
||||||
// val id: Long = 1234L,
|
// val id: Long = 1234L,
|
||||||
// val url: String = "https://example.com/inbox",
|
// val url: String = "https://example.com/inbox",
|
||||||
// val method: String = "GET"
|
// val method: String = "GET"
|
||||||
//)
|
// )
|
||||||
|
|
|
@ -16,17 +16,17 @@
|
||||||
|
|
||||||
package util
|
package util
|
||||||
//
|
//
|
||||||
//import dev.usbharu.hideout.core.infrastructure.springframework.httpsignature.HttpSignatureUser
|
// import dev.usbharu.hideout.core.infrastructure.springframework.httpsignature.HttpSignatureUser
|
||||||
//import dev.usbharu.httpsignature.common.HttpHeaders
|
// import dev.usbharu.httpsignature.common.HttpHeaders
|
||||||
//import dev.usbharu.httpsignature.common.HttpMethod
|
// import dev.usbharu.httpsignature.common.HttpMethod
|
||||||
//import dev.usbharu.httpsignature.common.HttpRequest
|
// import dev.usbharu.httpsignature.common.HttpRequest
|
||||||
//import org.springframework.security.core.context.SecurityContext
|
// import org.springframework.security.core.context.SecurityContext
|
||||||
//import org.springframework.security.core.context.SecurityContextHolder
|
// import org.springframework.security.core.context.SecurityContextHolder
|
||||||
//import org.springframework.security.test.context.support.WithSecurityContextFactory
|
// import org.springframework.security.test.context.support.WithSecurityContextFactory
|
||||||
//import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken
|
// import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken
|
||||||
//import java.net.URL
|
// import java.net.URL
|
||||||
//
|
//
|
||||||
//class WithMockHttpSignatureSecurityContextFactory :
|
// class WithMockHttpSignatureSecurityContextFactory :
|
||||||
// WithSecurityContextFactory<WithMockHttpSignature> {
|
// WithSecurityContextFactory<WithMockHttpSignature> {
|
||||||
//
|
//
|
||||||
// private val securityContextStrategy = SecurityContextHolder.getContextHolderStrategy()
|
// private val securityContextStrategy = SecurityContextHolder.getContextHolderStrategy()
|
||||||
|
@ -52,4 +52,4 @@ package util
|
||||||
// emptyContext.authentication = preAuthenticatedAuthenticationToken
|
// emptyContext.authentication = preAuthenticatedAuthenticationToken
|
||||||
// return emptyContext
|
// return emptyContext
|
||||||
// }
|
// }
|
||||||
//}
|
// }
|
||||||
|
|
Loading…
Reference in New Issue