Fall back to icannReferralEmail when creating registrars through the command line

This is if the separate email field isn't specified.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=239504636
This commit is contained in:
gbrodman 2019-03-20 16:55:59 -07:00 committed by jianglai
parent 1e2a60a390
commit 0ead4f8d9d
3 changed files with 44 additions and 20 deletions

View file

@ -89,6 +89,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.getLastUpdateTime()).isEqualTo(registrar.getCreationTime());
assertThat(registrar.getBlockPremiumNames()).isFalse();
assertThat(registrar.getPoNumber()).isEmpty();
assertThat(registrar.getIcannReferralEmail()).isEqualTo("foo@bar.test");
verify(connection)
.sendPostRequest(
@ -563,6 +564,27 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.get().getEmailAddress()).isEqualTo("foo@foo.foo");
}
@Test
public void testSuccess_fallBackToIcannReferralEmail() throws Exception {
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--street=\"123 Fake St\"",
"--city Fakington",
"--state MA",
"--zip 00351",
"--cc US",
"clientz");
Optional<Registrar> registrar = Registrar.loadByClientId("clientz");
assertThat(registrar).isPresent();
assertThat(registrar.get().getEmailAddress()).isEqualTo("foo@bar.test");
}
@Test
public void testSuccess_url() throws Exception {
runCommandForced(
@ -618,7 +640,6 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
"--billing_id=null",
"--phone=null",
"--fax=null",
"--email=null",
"--url=null",
"--drive_folder_id=null",
"--street=\"123 Fake St\"",
@ -635,7 +656,6 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.getBillingIdentifier()).isNull();
assertThat(registrar.getPhoneNumber()).isNull();
assertThat(registrar.getFaxNumber()).isNull();
assertThat(registrar.getEmailAddress()).isNull();
assertThat(registrar.getUrl()).isNull();
assertThat(registrar.getDriveFolderId()).isNull();
@ -651,7 +671,6 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
"--billing_id=",
"--phone=",
"--fax=",
"--email=",
"--url=",
"--drive_folder_id=",
"--icann_referral_email=foo@bar.test",
@ -669,7 +688,6 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.getBillingIdentifier()).isNull();
assertThat(registrar.getPhoneNumber()).isNull();
assertThat(registrar.getFaxNumber()).isNull();
assertThat(registrar.getEmailAddress()).isNull();
assertThat(registrar.getUrl()).isNull();
assertThat(registrar.getDriveFolderId()).isNull();
}