Add a boolean for when a registrar has enabled registry lock (#228)

* Add a boolean for when a registrar has enabled registry lock

* enabled -> allowed

* get -> is
This commit is contained in:
gbrodman 2019-08-16 10:46:07 -04:00 committed by GitHub
parent 57975898d5
commit 92f2f3274e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 80 additions and 0 deletions

View file

@ -88,6 +88,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.getCreationTime()).isIn(Range.closed(before, after));
assertThat(registrar.getLastUpdateTime()).isEqualTo(registrar.getCreationTime());
assertThat(registrar.getBlockPremiumNames()).isFalse();
assertThat(registrar.isRegistryLockAllowed()).isFalse();
assertThat(registrar.getPoNumber()).isEmpty();
assertThat(registrar.getIcannReferralEmail()).isEqualTo("foo@bar.test");
@ -766,6 +767,50 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.get().getBlockPremiumNames()).isFalse();
}
@Test
public void testSuccess_registryLockAllowed() throws Exception {
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--registry_lock_allowed=true",
"--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().isRegistryLockAllowed()).isTrue();
}
@Test
public void testSuccess_registryLockDisallowed() throws Exception {
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--registry_lock_allowed=false",
"--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().isRegistryLockAllowed()).isFalse();
}
@Test
public void testFailure_badPhoneNumber() {
ParameterException thrown =

View file

@ -364,6 +364,20 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
assertThat(loadRegistrar("NewRegistrar").getBlockPremiumNames()).isFalse();
}
@Test
public void testSuccess_allowRegistryLock() throws Exception {
assertThat(loadRegistrar("NewRegistrar").isRegistryLockAllowed()).isFalse();
runCommandForced("--registry_lock_allowed=true", "NewRegistrar");
assertThat(loadRegistrar("NewRegistrar").isRegistryLockAllowed()).isTrue();
}
@Test
public void testSuccess_disallowRegistryLock() throws Exception {
persistResource(loadRegistrar("NewRegistrar").asBuilder().setRegistryLockAllowed(true).build());
runCommandForced("--registry_lock_allowed=false", "NewRegistrar");
assertThat(loadRegistrar("NewRegistrar").isRegistryLockAllowed()).isFalse();
}
@Test
public void testSuccess_unspecifiedBooleansArentChanged() throws Exception {
persistResource(