remove targetUnixUser property from unit tests

This commit is contained in:
Michael Hoennig 2024-09-30 15:30:27 +02:00
parent 8ee04ecee3
commit 53259c357b

View File

@ -36,8 +36,7 @@ class HsDomainSetupBookingItemValidatorUnitTest {
.project(project) .project(project)
.caption("Test-Domain") .caption("Test-Domain")
.resources(Map.ofEntries( .resources(Map.ofEntries(
entry("domainName", "example.org"), entry("domainName", "example.org")
entry("targetUnixUser", "xyz00")
)) ))
.build(); .build();
@ -59,7 +58,6 @@ class HsDomainSetupBookingItemValidatorUnitTest {
.caption("Test-Domain") .caption("Test-Domain")
.resources(Map.ofEntries( .resources(Map.ofEntries(
entry("domainName", "example.org"), entry("domainName", "example.org"),
entry("targetUnixUser", "xyz00"),
entry("verificationCode", "1234-5678-9100") entry("verificationCode", "1234-5678-9100")
)) ))
.build(); .build();
@ -80,8 +78,7 @@ class HsDomainSetupBookingItemValidatorUnitTest {
.project(project) .project(project)
.caption("Test-Domain") .caption("Test-Domain")
.resources(Map.ofEntries( .resources(Map.ofEntries(
entry("domainName", right(TOO_LONG_DOMAIN_NAME, 253)), entry("domainName", right(TOO_LONG_DOMAIN_NAME, 253))
entry("targetUnixUser", "xyz00")
)) ))
.build(); .build();
@ -99,8 +96,7 @@ class HsDomainSetupBookingItemValidatorUnitTest {
.project(project) .project(project)
.caption("Test-Domain") .caption("Test-Domain")
.resources(Map.ofEntries( .resources(Map.ofEntries(
entry("domainName", right(TOO_LONG_DOMAIN_NAME, 254)), entry("domainName", right(TOO_LONG_DOMAIN_NAME, 254))
entry("targetUnixUser", "xyz00")
)) ))
.build(); .build();
@ -118,8 +114,7 @@ class HsDomainSetupBookingItemValidatorUnitTest {
.project(project) .project(project)
.caption("Test-Domain") .caption("Test-Domain")
.resources(Map.ofEntries( .resources(Map.ofEntries(
entry("domainName", "example.com"), entry("domainName", "example.com")
entry("targetUnixUser", "xyz00-test")
)) ))
.build(); .build();
@ -130,25 +125,6 @@ class HsDomainSetupBookingItemValidatorUnitTest {
assertThat(result).isEmpty(); assertThat(result).isEmpty();
} }
@Test
void rejectsInvalidUnixUser() {
final var domainSetupBookingItemEntity = HsBookingItemRealEntity.builder()
.type(DOMAIN_SETUP)
.project(project)
.caption("Test-Domain")
.resources(Map.ofEntries(
entry("domainName", "example.com"),
entry("targetUnixUser", "xyz00test")
))
.build();
// when
final var result = HsBookingItemEntityValidatorRegistry.doValidate(em, domainSetupBookingItemEntity);
// then
assertThat(result).contains("'D-12345:Test-Project:Test-Domain.resources.targetUnixUser' = 'xyz00test' is not a valid unix-user name");
}
@ParameterizedTest @ParameterizedTest
@ValueSource(strings = { @ValueSource(strings = {
"de", "com", "net", "org", "actually-any-top-level-domain", "de", "com", "net", "org", "actually-any-top-level-domain",
@ -196,8 +172,7 @@ class HsDomainSetupBookingItemValidatorUnitTest {
.project(project) .project(project)
.caption("Test-Domain") .caption("Test-Domain")
.resources(Map.ofEntries( .resources(Map.ofEntries(
entry("domainName", secondLevelRegistrarDomain), entry("domainName", secondLevelRegistrarDomain)
entry("targetUnixUser", "xyz00")
)) ))
.build(); .build();
@ -219,7 +194,6 @@ class HsDomainSetupBookingItemValidatorUnitTest {
// then // then
assertThat(validator.properties()).map(Map::toString).containsExactlyInAnyOrder( assertThat(validator.properties()).map(Map::toString).containsExactlyInAnyOrder(
"{type=string, propertyName=domainName, matchesRegEx=[^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,12}], matchesRegExDescription=is not a (non-top-level) fully qualified domain name, notMatchesRegEx=[[^.]+, (co|org|gov|ac|sch)\\.uk, (com|net|org|edu|gov|asn|id)\\.au, (co|ne|or|ac|go)\\.jp, (com|net|org|gov|edu|ac)\\.cn, (com|net|org|gov|edu|mil|art)\\.br, (co|net|org|gen|firm|ind)\\.in, (com|net|org|gob|edu)\\.mx, (gov|edu)\\.it, (co|net|org|govt|ac|school|geek|kiwi)\\.nz, (co|ne|or|go|re|pe)\\.kr], notMatchesRegExDescription=is a forbidden registrar-level domain name, maxLength=253, required=true, writeOnce=true}", "{type=string, propertyName=domainName, matchesRegEx=[^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,12}], matchesRegExDescription=is not a (non-top-level) fully qualified domain name, notMatchesRegEx=[[^.]+, (co|org|gov|ac|sch)\\.uk, (com|net|org|edu|gov|asn|id)\\.au, (co|ne|or|ac|go)\\.jp, (com|net|org|gov|edu|ac)\\.cn, (com|net|org|gov|edu|mil|art)\\.br, (co|net|org|gen|firm|ind)\\.in, (com|net|org|gob|edu)\\.mx, (gov|edu)\\.it, (co|net|org|govt|ac|school|geek|kiwi)\\.nz, (co|ne|or|go|re|pe)\\.kr], notMatchesRegExDescription=is a forbidden registrar-level domain name, maxLength=253, required=true, writeOnce=true}",
"{type=string, propertyName=targetUnixUser, matchesRegEx=[^[a-z][a-z0-9]{2}[0-9]{2}$|^[a-z][a-z0-9]{2}[0-9]{2}-[a-z0-9\\._-]+$], matchesRegExDescription=is not a valid unix-user name, maxLength=253, required=true, writeOnce=true}",
"{type=string, propertyName=verificationCode, minLength=12, maxLength=64, computed=IN_INIT}"); "{type=string, propertyName=verificationCode, minLength=12, maxLength=64, computed=IN_INIT}");
} }
} }