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