add business-level tests with parent asset
This commit is contained in:
parent
ca63d957e4
commit
8d69f2ed39
@ -281,7 +281,7 @@ class HsDomainSetupHostingAssetValidatorUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void rejectsSetupOfHostsharingDmain() {
|
void rejectsSetupOfHostsharingDomain() {
|
||||||
domainSetupFor("hostsharing.net").notRegistered()
|
domainSetupFor("hostsharing.net").notRegistered()
|
||||||
.isRejectedWithCauseForbidden("Hostsharing domain name");
|
.isRejectedWithCauseForbidden("Hostsharing domain name");
|
||||||
}
|
}
|
||||||
@ -322,6 +322,18 @@ class HsDomainSetupHostingAssetValidatorUnitTest {
|
|||||||
.isAccepted();
|
.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
|
@Test
|
||||||
void allowSetupOfUnregisteredSubdomainWithValidDnsVerificationInSuperDomain() {
|
void allowSetupOfUnregisteredSubdomainWithValidDnsVerificationInSuperDomain() {
|
||||||
domainSetupFor("sub.example.org").notRegistered().withVerificationIn("example.org")
|
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}(?<!-))\\.example\\.net', but is 'sub.example.org'"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void isAccepted() {
|
void isAccepted() {
|
||||||
assertThat(validate()).isEmpty();
|
assertThat(validate()).isEmpty();
|
||||||
}
|
}
|
||||||
@ -490,6 +508,12 @@ class HsDomainSetupHostingAssetValidatorUnitTest {
|
|||||||
return HostingAssetEntityValidatorRegistry.forType(DOMAIN_SETUP)
|
return HostingAssetEntityValidatorRegistry.forType(DOMAIN_SETUP)
|
||||||
.validateEntity(domainAsset);
|
.validateEntity(domainAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DomainSetupBuilder withParentAsset(final String parentAssetDomainName) {
|
||||||
|
domainAsset.setBookingItem(null);
|
||||||
|
domainAsset.setParentAsset(HsHostingAssetRealEntity.builder().type(DOMAIN_SETUP).identifier(parentAssetDomainName).build());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainSetupBuilder domainSetupFor(final String domainName) {
|
private DomainSetupBuilder domainSetupFor(final String domainName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user