mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Create OT&E entities directly, instead of calling sub-commands
This is in preparation for having a web-console endpoint to create OTE. In addition - we streamline the code: - we remove support for different premium lists - we remove support for different DNS writers - we never want a "real" DnsWriter for OTE - we remove support of --eap_only, because we don't need it anymore - We use a single password for all the Registrars ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=225841694
This commit is contained in:
parent
1004ef5621
commit
9d6a7ef66a
6 changed files with 904 additions and 488 deletions
|
@ -34,6 +34,7 @@ import google.registry.model.registrar.RegistrarContact;
|
|||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.registry.Registry.TldState;
|
||||
import google.registry.testing.DeterministicStringGenerator;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.util.CidrAddressBlock;
|
||||
import java.security.cert.CertificateParsingException;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
@ -46,23 +47,16 @@ import org.junit.Test;
|
|||
/** Unit tests for {@link SetupOteCommand}. */
|
||||
public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
||||
|
||||
ImmutableList<String> passwords =
|
||||
ImmutableList.of(
|
||||
"abcdefghijklmnop",
|
||||
"qrstuvwxyzabcdef",
|
||||
"ghijklmnopqrstuv",
|
||||
"wxyzabcdefghijkl",
|
||||
"mnopqrstuvwxyzab");
|
||||
static final String PASSWORD = "abcdefghijklmnop";
|
||||
|
||||
DeterministicStringGenerator passwordGenerator =
|
||||
new DeterministicStringGenerator("abcdefghijklmnopqrstuvwxyz");
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
SetupOteCommand.interactive = false;
|
||||
command.validDnsWriterNames = ImmutableSet.of("FooDnsWriter", "BarDnsWriter", "VoidDnsWriter");
|
||||
command.passwordGenerator = passwordGenerator;
|
||||
command.clock = new FakeClock(DateTime.parse("2018-07-07TZ"));
|
||||
persistPremiumList("default_sandbox_list", "sandbox,USD 1000");
|
||||
persistPremiumList("alternate_list", "rich,USD 3000");
|
||||
}
|
||||
|
||||
/** Verify TLD creation. */
|
||||
|
@ -70,8 +64,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
String tldName,
|
||||
String roidSuffix,
|
||||
TldState tldState,
|
||||
String dnsWriter,
|
||||
String premiumList,
|
||||
Duration addGracePeriodLength,
|
||||
Duration redemptionGracePeriodLength,
|
||||
Duration pendingDeleteLength,
|
||||
|
@ -80,9 +72,9 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
assertThat(registry).isNotNull();
|
||||
assertThat(registry.getRoidSuffix()).isEqualTo(roidSuffix);
|
||||
assertThat(registry.getTldState(DateTime.now(UTC))).isEqualTo(tldState);
|
||||
assertThat(registry.getDnsWriters()).containsExactly(dnsWriter);
|
||||
assertThat(registry.getDnsWriters()).containsExactly("VoidDnsWriter");
|
||||
assertThat(registry.getPremiumList()).isNotNull();
|
||||
assertThat(registry.getPremiumList().getName()).isEqualTo(premiumList);
|
||||
assertThat(registry.getPremiumList().getName()).isEqualTo("default_sandbox_list");
|
||||
assertThat(registry.getAddGracePeriodLength()).isEqualTo(addGracePeriodLength);
|
||||
assertThat(registry.getRedemptionGracePeriodLength()).isEqualTo(redemptionGracePeriodLength);
|
||||
assertThat(registry.getPendingDeleteLength()).isEqualTo(pendingDeleteLength);
|
||||
|
@ -98,20 +90,18 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
Money.of(CurrencyUnit.USD, 0),
|
||||
DateTime.parse("2018-03-01T00:00:00Z"),
|
||||
Money.of(CurrencyUnit.USD, 100),
|
||||
DateTime.parse("2022-03-01T00:00:00Z"),
|
||||
DateTime.parse("2030-03-01T00:00:00Z"),
|
||||
Money.of(CurrencyUnit.USD, 0)));
|
||||
}
|
||||
}
|
||||
|
||||
/** Verify TLD creation with registry default durations. */
|
||||
private void verifyTldCreation(
|
||||
String tldName, String roidSuffix, TldState tldState, String dnsWriter, String premiumList) {
|
||||
String tldName, String roidSuffix, TldState tldState) {
|
||||
verifyTldCreation(
|
||||
tldName,
|
||||
roidSuffix,
|
||||
tldState,
|
||||
dnsWriter,
|
||||
premiumList,
|
||||
Registry.DEFAULT_ADD_GRACE_PERIOD,
|
||||
Registry.DEFAULT_REDEMPTION_GRACE_PERIOD,
|
||||
Registry.DEFAULT_PENDING_DELETE_LENGTH,
|
||||
|
@ -162,23 +152,14 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename());
|
||||
|
||||
verifyTldCreation(
|
||||
"blobio-sunrise",
|
||||
"BLOBIOS0",
|
||||
TldState.START_DATE_SUNRISE,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list");
|
||||
verifyTldCreation(
|
||||
"blobio-landrush", "BLOBIOL1", TldState.LANDRUSH, "VoidDnsWriter", "default_sandbox_list");
|
||||
verifyTldCreation("blobio-sunrise", "BLOBIOS0", TldState.START_DATE_SUNRISE);
|
||||
verifyTldCreation("blobio-landrush", "BLOBIOL1", TldState.LANDRUSH);
|
||||
verifyTldCreation(
|
||||
"blobio-ga",
|
||||
"BLOBIOG2",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
|
@ -187,8 +168,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"blobio-eap",
|
||||
"BLOBIOE3",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
|
@ -197,11 +176,11 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
ImmutableList<CidrAddressBlock> ipAddress = ImmutableList.of(
|
||||
CidrAddressBlock.create("1.1.1.1"));
|
||||
|
||||
verifyRegistrarCreation("blobio-1", "blobio-sunrise", passwords.get(0), ipAddress);
|
||||
verifyRegistrarCreation("blobio-2", "blobio-landrush", passwords.get(1), ipAddress);
|
||||
verifyRegistrarCreation("blobio-3", "blobio-ga", passwords.get(2), ipAddress);
|
||||
verifyRegistrarCreation("blobio-4", "blobio-ga", passwords.get(3), ipAddress);
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", passwords.get(4), ipAddress);
|
||||
verifyRegistrarCreation("blobio-1", "blobio-sunrise", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("blobio-2", "blobio-landrush", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("blobio-3", "blobio-ga", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("blobio-4", "blobio-ga", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", PASSWORD, ipAddress);
|
||||
|
||||
verifyRegistrarContactCreation("blobio-1", "contact@email.com");
|
||||
verifyRegistrarContactCreation("blobio-2", "contact@email.com");
|
||||
|
@ -216,23 +195,14 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=abc",
|
||||
"--email=abc@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename());
|
||||
|
||||
verifyTldCreation(
|
||||
"abc-sunrise",
|
||||
"ABCSUNR0",
|
||||
TldState.START_DATE_SUNRISE,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list");
|
||||
verifyTldCreation(
|
||||
"abc-landrush", "ABCLAND1", TldState.LANDRUSH, "VoidDnsWriter", "default_sandbox_list");
|
||||
verifyTldCreation("abc-sunrise", "ABCSUNR0", TldState.START_DATE_SUNRISE);
|
||||
verifyTldCreation("abc-landrush", "ABCLAND1", TldState.LANDRUSH);
|
||||
verifyTldCreation(
|
||||
"abc-ga",
|
||||
"ABCGA2",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
|
@ -241,8 +211,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"abc-eap",
|
||||
"ABCEAP3",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
|
@ -251,11 +219,11 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
ImmutableList<CidrAddressBlock> ipAddress =
|
||||
ImmutableList.of(CidrAddressBlock.create("1.1.1.1"));
|
||||
|
||||
verifyRegistrarCreation("abc-1", "abc-sunrise", passwords.get(0), ipAddress);
|
||||
verifyRegistrarCreation("abc-2", "abc-landrush", passwords.get(1), ipAddress);
|
||||
verifyRegistrarCreation("abc-3", "abc-ga", passwords.get(2), ipAddress);
|
||||
verifyRegistrarCreation("abc-4", "abc-ga", passwords.get(3), ipAddress);
|
||||
verifyRegistrarCreation("abc-5", "abc-eap", passwords.get(4), ipAddress);
|
||||
verifyRegistrarCreation("abc-1", "abc-sunrise", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("abc-2", "abc-landrush", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("abc-3", "abc-ga", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("abc-4", "abc-ga", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("abc-5", "abc-eap", PASSWORD, ipAddress);
|
||||
|
||||
verifyRegistrarContactCreation("abc-1", "abc@email.com");
|
||||
verifyRegistrarContactCreation("abc-2", "abc@email.com");
|
||||
|
@ -267,19 +235,15 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testSuccess_certificateHash() throws Exception {
|
||||
runCommandForced(
|
||||
"--eap_only",
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certhash=" + SAMPLE_CERT_HASH);
|
||||
|
||||
verifyTldCreation(
|
||||
"blobio-eap",
|
||||
"BLOBIOE3",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
|
@ -288,36 +252,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
ImmutableList<CidrAddressBlock> ipAddress =
|
||||
ImmutableList.of(CidrAddressBlock.create("1.1.1.1"));
|
||||
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", passwords.get(0), ipAddress, true);
|
||||
|
||||
verifyRegistrarContactCreation("blobio-5", "contact@email.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_eapOnly() throws Exception {
|
||||
runCommandForced(
|
||||
"--eap_only",
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename());
|
||||
|
||||
verifyTldCreation(
|
||||
"blobio-eap",
|
||||
"BLOBIOE3",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"VoidDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
true);
|
||||
|
||||
ImmutableList<CidrAddressBlock> ipAddress = ImmutableList.of(
|
||||
CidrAddressBlock.create("1.1.1.1"));
|
||||
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", passwords.get(0), ipAddress);
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", PASSWORD, ipAddress, true);
|
||||
|
||||
verifyRegistrarContactCreation("blobio-5", "contact@email.com");
|
||||
}
|
||||
|
@ -328,23 +263,14 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1,2.2.2.2",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=FooDnsWriter",
|
||||
"--certfile=" + getCertFilename());
|
||||
|
||||
verifyTldCreation(
|
||||
"blobio-sunrise",
|
||||
"BLOBIOS0",
|
||||
TldState.START_DATE_SUNRISE,
|
||||
"FooDnsWriter",
|
||||
"default_sandbox_list");
|
||||
verifyTldCreation(
|
||||
"blobio-landrush", "BLOBIOL1", TldState.LANDRUSH, "FooDnsWriter", "default_sandbox_list");
|
||||
verifyTldCreation("blobio-sunrise", "BLOBIOS0", TldState.START_DATE_SUNRISE);
|
||||
verifyTldCreation("blobio-landrush", "BLOBIOL1", TldState.LANDRUSH);
|
||||
verifyTldCreation(
|
||||
"blobio-ga",
|
||||
"BLOBIOG2",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"FooDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
|
@ -353,8 +279,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"blobio-eap",
|
||||
"BLOBIOE3",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"FooDnsWriter",
|
||||
"default_sandbox_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
|
@ -364,66 +288,11 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
CidrAddressBlock.create("1.1.1.1"),
|
||||
CidrAddressBlock.create("2.2.2.2"));
|
||||
|
||||
verifyRegistrarCreation("blobio-1", "blobio-sunrise", passwords.get(0), ipAddresses);
|
||||
verifyRegistrarCreation("blobio-2", "blobio-landrush", passwords.get(1), ipAddresses);
|
||||
verifyRegistrarCreation("blobio-3", "blobio-ga", passwords.get(2), ipAddresses);
|
||||
verifyRegistrarCreation("blobio-4", "blobio-ga", passwords.get(3), ipAddresses);
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", passwords.get(4), ipAddresses);
|
||||
|
||||
verifyRegistrarContactCreation("blobio-1", "contact@email.com");
|
||||
verifyRegistrarContactCreation("blobio-2", "contact@email.com");
|
||||
verifyRegistrarContactCreation("blobio-3", "contact@email.com");
|
||||
verifyRegistrarContactCreation("blobio-4", "contact@email.com");
|
||||
verifyRegistrarContactCreation("blobio-5", "contact@email.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_alternatePremiumList() throws Exception {
|
||||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--certfile=" + getCertFilename(),
|
||||
"--dns_writers=BarDnsWriter",
|
||||
"--premium_list=alternate_list");
|
||||
|
||||
verifyTldCreation(
|
||||
"blobio-sunrise",
|
||||
"BLOBIOS0",
|
||||
TldState.START_DATE_SUNRISE,
|
||||
"BarDnsWriter",
|
||||
"alternate_list");
|
||||
verifyTldCreation(
|
||||
"blobio-landrush", "BLOBIOL1", TldState.LANDRUSH, "BarDnsWriter", "alternate_list");
|
||||
verifyTldCreation(
|
||||
"blobio-ga",
|
||||
"BLOBIOG2",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"BarDnsWriter",
|
||||
"alternate_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
false);
|
||||
verifyTldCreation(
|
||||
"blobio-eap",
|
||||
"BLOBIOE3",
|
||||
TldState.GENERAL_AVAILABILITY,
|
||||
"BarDnsWriter",
|
||||
"alternate_list",
|
||||
Duration.standardMinutes(60),
|
||||
Duration.standardMinutes(10),
|
||||
Duration.standardMinutes(5),
|
||||
true);
|
||||
|
||||
ImmutableList<CidrAddressBlock> ipAddress = ImmutableList.of(
|
||||
CidrAddressBlock.create("1.1.1.1"));
|
||||
|
||||
verifyRegistrarCreation("blobio-1", "blobio-sunrise", passwords.get(0), ipAddress);
|
||||
verifyRegistrarCreation("blobio-2", "blobio-landrush", passwords.get(1), ipAddress);
|
||||
verifyRegistrarCreation("blobio-3", "blobio-ga", passwords.get(2), ipAddress);
|
||||
verifyRegistrarCreation("blobio-4", "blobio-ga", passwords.get(3), ipAddress);
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", passwords.get(4), ipAddress);
|
||||
verifyRegistrarCreation("blobio-1", "blobio-sunrise", PASSWORD, ipAddresses);
|
||||
verifyRegistrarCreation("blobio-2", "blobio-landrush", PASSWORD, ipAddresses);
|
||||
verifyRegistrarCreation("blobio-3", "blobio-ga", PASSWORD, ipAddresses);
|
||||
verifyRegistrarCreation("blobio-4", "blobio-ga", PASSWORD, ipAddresses);
|
||||
verifyRegistrarCreation("blobio-5", "blobio-eap", PASSWORD, ipAddresses);
|
||||
|
||||
verifyRegistrarContactCreation("blobio-1", "contact@email.com");
|
||||
verifyRegistrarContactCreation("blobio-2", "contact@email.com");
|
||||
|
@ -441,7 +310,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
runCommandForced(
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("option is required: -w, --ip_whitelist");
|
||||
}
|
||||
|
@ -455,7 +323,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("option is required: -r, --registrar");
|
||||
}
|
||||
|
@ -469,7 +336,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--registrar=blobio"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
|
@ -486,7 +352,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--registrar=blobio",
|
||||
"--certfile=" + getCertFilename(),
|
||||
"--certhash=" + SAMPLE_CERT_HASH));
|
||||
|
@ -496,20 +361,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"Must specify exactly one of client certificate file or client certificate hash.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_missingDnsWriter() {
|
||||
ParameterException thrown =
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--email=contact@email.com",
|
||||
"--certfile=" + getCertFilename(),
|
||||
"--registrar=blobio"));
|
||||
assertThat(thrown).hasMessageThat().contains("option is required: --dns_writers");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_missingEmail() {
|
||||
ParameterException thrown =
|
||||
|
@ -518,7 +369,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
() ->
|
||||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename(),
|
||||
"--registrar=blobio"));
|
||||
assertThat(thrown).hasMessageThat().contains("option is required: --email");
|
||||
|
@ -534,7 +384,6 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=/dev/null"));
|
||||
assertThat(thrown).hasMessageThat().contains("No X509Certificate found");
|
||||
}
|
||||
|
@ -549,26 +398,8 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=3blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar name is invalid");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_invalidDnsWriter() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=InvalidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Invalid DNS writer name(s) specified: [InvalidDnsWriter]");
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid registrar name: 3blobio");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -581,9 +412,8 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=bl",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar name is invalid");
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid registrar name: bl");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -596,9 +426,8 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobiotoooolong",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar name is invalid");
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid registrar name: blobiotoooolong");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -611,25 +440,8 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blo#bio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar name is invalid");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_invalidPremiumList() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename(),
|
||||
"--premium_list=foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("The premium list 'foo' doesn't exist");
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid registrar name: blo#bio");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -643,9 +455,23 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("TLD 'blobio-sunrise' already exists");
|
||||
assertThat(thrown).hasMessageThat().contains("Registry(\"blobio-sunrise\")");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_tldExists_replaceExisting() throws Exception {
|
||||
createTld("blobio-sunrise");
|
||||
|
||||
runCommandForced(
|
||||
"--overwrite",
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--certfile=" + getCertFilename());
|
||||
|
||||
verifyTldCreation("blobio-sunrise", "BLOBIOS0", TldState.START_DATE_SUNRISE);
|
||||
verifyTldCreation("blobio-landrush", "BLOBIOL1", TldState.LANDRUSH);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -663,8 +489,29 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar blobio-1 already exists");
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar(\"blobio-1\")");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_registrarExists_replaceExisting() throws Exception {
|
||||
Registrar registrar = loadRegistrar("TheRegistrar").asBuilder()
|
||||
.setClientId("blobio-1")
|
||||
.setRegistrarName("blobio-1")
|
||||
.build();
|
||||
persistResource(registrar);
|
||||
|
||||
runCommandForced(
|
||||
"--overwrite",
|
||||
"--ip_whitelist=1.1.1.1",
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--certfile=" + getCertFilename());
|
||||
|
||||
ImmutableList<CidrAddressBlock> ipAddress = ImmutableList.of(
|
||||
CidrAddressBlock.create("1.1.1.1"));
|
||||
|
||||
verifyRegistrarCreation("blobio-1", "blobio-sunrise", PASSWORD, ipAddress);
|
||||
verifyRegistrarCreation("blobio-2", "blobio-landrush", PASSWORD, ipAddress);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue