test: テストの前提条件SQLをコードから安全に生成できるように

This commit is contained in:
usbharu 2024-09-10 23:45:22 +09:00
parent e67eb788a7
commit 1983841cef
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
2 changed files with 9 additions and 126 deletions

View File

@ -40,18 +40,7 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
execute(Operations.sql("SET REFERENTIAL_INTEGRITY FALSE")) execute(Operations.sql("SET REFERENTIAL_INTEGRITY FALSE"))
insertInto(Instance.tableName) { insertInto(Instance.tableName) {
columns( columns(
"ID", Instance.columns
"name",
"DESCRIPTION",
"URL",
"ICON_URL",
"SHARED_INBOX",
"SOFTWARE",
"VERSION",
"IS_BLOCKED",
"IS_MUTED",
"MODERATION_NOTE",
"CREATED_AT"
) )
values( values(
1, 1,
@ -70,33 +59,7 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
} }
insertInto("public.actors") { insertInto("public.actors") {
columns( columns(
"id", Actors.columns
"name",
"domain",
"screen_name",
"description",
"inbox",
"outbox",
"url",
"public_key",
"private_key",
"created_at",
"key_id",
"following",
"followers",
"instance",
"locked",
"following_count",
"followers_count",
"posts_count",
"last_post_at",
"last_update_at",
"suspend",
"move_to",
"emojis",
"deleted",
"icon",
"banner"
) )
values( values(
1, 1,
@ -153,18 +116,7 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
execute(Operations.sql("SET REFERENTIAL_INTEGRITY FALSE")) execute(Operations.sql("SET REFERENTIAL_INTEGRITY FALSE"))
insertInto(Instance.tableName) { insertInto(Instance.tableName) {
columns( columns(
"ID", Instance.columns
"name",
"DESCRIPTION",
"URL",
"ICON_URL",
"SHARED_INBOX",
"SOFTWARE",
"VERSION",
"IS_BLOCKED",
"IS_MUTED",
"MODERATION_NOTE",
"CREATED_AT"
) )
values( values(
1, 1,
@ -183,33 +135,7 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac
} }
insertInto("public.actors") { insertInto("public.actors") {
columns( columns(
"id", Actors.columns
"name",
"domain",
"screen_name",
"description",
"inbox",
"outbox",
"url",
"public_key",
"private_key",
"created_at",
"key_id",
"following",
"followers",
"instance",
"locked",
"following_count",
"followers_count",
"posts_count",
"last_post_at",
"last_update_at",
"suspend",
"move_to",
"emojis",
"deleted",
"icon",
"banner"
) )
values( values(
1, 1,

View File

@ -8,6 +8,7 @@ import org.assertj.db.api.Assertions.assertThat
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance
import utils.AbstractRepositoryTest import utils.AbstractRepositoryTest
import utils.columns
import utils.isEqualTo import utils.isEqualTo
import utils.value import utils.value
import java.net.URI import java.net.URI
@ -56,18 +57,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
dbSetup(to = dataSource) { dbSetup(to = dataSource) {
insertInto(InstanceTable.tableName) { insertInto(InstanceTable.tableName) {
columns( columns(
"ID", InstanceTable.columns
"name",
"DESCRIPTION",
"URL",
"ICON_URL",
"SHARED_INBOX",
"SOFTWARE",
"VERSION",
"IS_BLOCKED",
"IS_MUTED",
"MODERATION_NOTE",
"CREATED_AT"
) )
values( values(
1, 1,
@ -119,18 +109,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
dbSetup(to = dataSource) { dbSetup(to = dataSource) {
insertInto(InstanceTable.tableName) { insertInto(InstanceTable.tableName) {
columns( columns(
"ID", InstanceTable.columns
"name",
"DESCRIPTION",
"URL",
"ICON_URL",
"SHARED_INBOX",
"SOFTWARE",
"VERSION",
"IS_BLOCKED",
"IS_MUTED",
"MODERATION_NOTE",
"CREATED_AT"
) )
values( values(
1, 1,
@ -178,18 +157,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
dbSetup(to = dataSource) { dbSetup(to = dataSource) {
insertInto(InstanceTable.tableName) { insertInto(InstanceTable.tableName) {
columns( columns(
"ID", InstanceTable.columns
"name",
"DESCRIPTION",
"URL",
"ICON_URL",
"SHARED_INBOX",
"SOFTWARE",
"VERSION",
"IS_BLOCKED",
"IS_MUTED",
"MODERATION_NOTE",
"CREATED_AT"
) )
values( values(
1, 1,
@ -237,18 +205,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
dbSetup(to = dataSource) { dbSetup(to = dataSource) {
insertInto(InstanceTable.tableName) { insertInto(InstanceTable.tableName) {
columns( columns(
"ID", InstanceTable.columns
"name",
"DESCRIPTION",
"URL",
"ICON_URL",
"SHARED_INBOX",
"SOFTWARE",
"VERSION",
"IS_BLOCKED",
"IS_MUTED",
"MODERATION_NOTE",
"CREATED_AT"
) )
values( values(
1, 1,