From 8d69f2ed39250e3efb2d48c23465b5ce5895d90e Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 12 Sep 2024 07:13:15 +0200 Subject: [PATCH] add business-level tests with parent asset --- ...ainSetupHostingAssetValidatorUnitTest.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidatorUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidatorUnitTest.java index f7c09092..36cb2504 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidatorUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidatorUnitTest.java @@ -281,7 +281,7 @@ class HsDomainSetupHostingAssetValidatorUnitTest { } @Test - void rejectsSetupOfHostsharingDmain() { + void rejectsSetupOfHostsharingDomain() { domainSetupFor("hostsharing.net").notRegistered() .isRejectedWithCauseForbidden("Hostsharing domain name"); } @@ -322,6 +322,18 @@ class HsDomainSetupHostingAssetValidatorUnitTest { .isAccepted(); } + @Test + void allowSetupOfUnregisteredSubdomainIfSuperDomainParentAssetIsSpecified() { + domainSetupFor("sub.example.org").notRegistered().withParentAsset("example.org") + .isAccepted(); + } + + @Test + void rejectSetupOfUnregisteredSubdomainIfWrongParentAssetIsSpecified() { + domainSetupFor("sub.example.org").notRegistered().withParentAsset("example.net") + .isRejectedDueToInvalidIdentifier(); + } + @Test void allowSetupOfUnregisteredSubdomainWithValidDnsVerificationInSuperDomain() { domainSetupFor("sub.example.org").notRegistered().withVerificationIn("example.org") @@ -470,6 +482,12 @@ class HsDomainSetupHostingAssetValidatorUnitTest { ); } + void isRejectedDueToInvalidIdentifier() { + assertThat(validate()).contains( + "'identifier' expected to match '(\\*|(?!-)[A-Za-z0-9-]{1,63}(?