Add a flag to registry_tool for EAP

Add a flag to CreateTldCommand to allow us to set the EAP fee schedule for the
registry.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125068579
This commit is contained in:
mmuller 2016-06-16 09:33:53 -07:00 committed by Ben McIlwain
parent a277e7c040
commit 4f91d03704
3 changed files with 48 additions and 3 deletions

View file

@ -44,6 +44,8 @@ import java.io.PrintStream;
/** Unit tests for {@link CreateTldCommand}. */
public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
private static final String DATETIME_FORMAT = "YYYY-MM-dd'T'HH:mm:ssZZ";
@Before
public void init() {
persistReservedList("common_abuse", "baa,FULLY_BLOCKED");
@ -91,6 +93,25 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
.isEqualTo(Money.of(USD, 42.42));
}
@Test
public void testSuccess_eapFeeSchedule() throws Exception {
DateTime now = DateTime.now(UTC);
DateTime tomorrow = now.plusDays(1);
runCommandForced(
String.format(
"--eap_fee_schedule=\"%s=USD 0.00,%s=USD 50.00,%s=USD 10.00\"",
START_OF_TIME.toString(DATETIME_FORMAT),
now.toString(DATETIME_FORMAT),
tomorrow.toString(DATETIME_FORMAT)),
"--roid_suffix=Q9JYB4C",
"xn--q9jyb4c");
Registry registry = Registry.get("xn--q9jyb4c");
assertThat(registry.getEapFeeFor(now.minusHours(1))).isEqualTo(Money.zero(USD));
assertThat(registry.getEapFeeFor(now.plusHours(1))).isEqualTo(Money.of(USD, 50));
assertThat(registry.getEapFeeFor(now.plusDays(1).plusHours(1))).isEqualTo(Money.of(USD, 10));
}
@Test
public void testSuccess_addGracePeriodFlag() throws Exception {
runCommandForced("--add_grace_period=PT300S", "--roid_suffix=Q9JYB4C", "xn--q9jyb4c");
@ -230,6 +251,17 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
"--initial_renew_billing_cost=USD -42", "--roid_suffix=Q9JYB4C", "xn--q9jyb4c");
}
@Test
public void testFailure_invalidEapCurrency() throws Exception {
thrown.expect(IllegalArgumentException.class);
runCommandForced(
String.format(
"--eap_fee_schedule=\"%s=JPY 123456\"",
START_OF_TIME.toString(DATETIME_FORMAT)),
"--roid_suffix=Q9JYB4C",
"xn--q9jyb4c");
}
@Test
public void testFailure_noTldName() throws Exception {
thrown.expect(ParameterException.class);