Skip to content

Commit

Permalink
clean up PulumiNameTest
Browse files Browse the repository at this point in the history
Signed-off-by: Julia Plewa <jplewa@virtuslab.com>
  • Loading branch information
jplewa committed Jul 26, 2023
1 parent 4930c82 commit 27c924b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/test/kotlin/org/virtuslab/pulumikotlin/TestUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.pulumi.core.Output
import io.github.cdklabs.projen.java.JavaProject
import io.github.cdklabs.projen.java.JavaProjectOptions
import org.junit.jupiter.api.Assertions.assertFalse
import org.virtuslab.pulumikotlin.codegen.step2intermediate.PulumiName
import org.virtuslab.pulumikotlin.codegen.step2intermediate.PulumiNamingConfiguration
import java.io.File
import java.time.LocalDateTime
Expand All @@ -25,6 +26,9 @@ internal fun namingConfigurationWithSlashInModuleFormat(
packageOverrides = packageOverrides,
)

internal fun pulumiName(providerName: String, baseNamespace: List<String>, moduleName: String, name: String) =
PulumiName(providerName, null, baseNamespace, moduleName, name, false)

private fun messagePrefix(message: String?) = if (message == null) "" else "$message. "

internal fun <T> assertDoesNotContain(iterable: Iterable<T>, element: T, message: String? = null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import org.virtuslab.pulumikotlin.codegen.step2intermediate.Subject.Function
import org.virtuslab.pulumikotlin.codegen.step2intermediate.Subject.Resource
import org.virtuslab.pulumikotlin.codegen.utils.DEFAULT_PROVIDER_TOKEN
import org.virtuslab.pulumikotlin.namingConfigurationWithSlashInModuleFormat
import org.virtuslab.pulumikotlin.pulumiName

internal class PulumiNameTest {

Expand All @@ -28,17 +29,17 @@ internal class PulumiNameTest {
TypeName(
"aws:acm/CertificateOptions:CertificateOptions",
namingConfigurationWithSlashInModuleFormat("aws"),
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
),
ResourceName(
"aws:acm/certificate:Certificate",
namingConfigurationWithSlashInModuleFormat("aws"),
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "Certificate", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "Certificate"),
),
FunctionName(
"aws:acmpca/getCertificateAuthority:getCertificateAuthority",
namingConfigurationWithSlashInModuleFormat("aws"),
PulumiName("aws", null, listOf("com", "pulumi"), "acmpca", "getCertificateAuthority", false),
pulumiName("aws", listOf("com", "pulumi"), "acmpca", "getCertificateAuthority"),
),
LongFunctionName(
"aws:acmpca/getCertificateAuthorityRevocationConfigurationCrlConfiguration:getCertificateAuthorityRevocationConfigurationCrlConfiguration",
Expand Down Expand Up @@ -69,43 +70,43 @@ internal class PulumiNameTest {
val expectedPackageWithModifiers: String,
) {
KotlinResourceInput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Resource, Input, Kotlin, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.kotlin.enums",
),
KotlinResourceOutput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Resource, Output, Kotlin, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.kotlin.enums",
),
KotlinFunctionInput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Function, Input, Kotlin, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.kotlin.enums",
),
KotlinFunctionOutput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Function, Output, Kotlin, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.kotlin.enums",
),

JavaResourceInput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Resource, Input, Java, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.enums",
),
JavaResourceOutput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Resource, Output, Java, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.enums",
),
JavaFunctionInput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Function, Input, Java, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.enums",
),
JavaFunctionOutput(
PulumiName("aws", null, listOf("com", "pulumi"), "acm", "CertificateOptions", false),
pulumiName("aws", listOf("com", "pulumi"), "acm", "CertificateOptions"),
NamingFlags(Nested, Function, Output, Java, GeneratedClass.EnumClass),
"com.pulumi.aws.acm.enums",
),
Expand Down

0 comments on commit 27c924b

Please sign in to comment.