Default to admin registrar in check_domain commands

The vast majority of the time this is the registrar client ID you want, so
there's no reason to require specifying it everything each time. These are
read-only commands anyway, so the potential negative effects are minimal.

See the existing lock/unlock_domain commands for existing occurrences of this
behavior.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211857712
This commit is contained in:
mcilwain 2018-09-06 13:20:21 -07:00 committed by jianglai
parent 72bfd43e00
commit 22e1d905b6
5 changed files with 52 additions and 8 deletions

View file

@ -14,14 +14,23 @@
package google.registry.tools;
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.beust.jcommander.ParameterException;
import google.registry.model.registrar.Registrar.Type;
import org.junit.Before;
import org.junit.Test;
/** Unit tests for {@link CheckDomainCommand}. */
public class CheckDomainCommandTest extends EppToolCommandTestCase<CheckDomainCommand> {
@Before
public void before() {
persistNewRegistrar("adminreg", "Admin Registrar", Type.REAL, 693L);
command.registryAdminClientId = "adminreg";
}
@Test
public void testSuccess() throws Exception {
runCommand("--client=NewRegistrar", "example.tld");
@ -62,8 +71,9 @@ public class CheckDomainCommandTest extends EppToolCommandTestCase<CheckDomainCo
}
@Test
public void testFailure_missingClientId() {
assertThrows(ParameterException.class, () -> runCommand("example.tld"));
public void testSuccess_unspecifiedClientId_defaultsToRegistryRegistrar() throws Exception {
runCommand("example.tld");
eppVerifier.expectDryRun().expectClientId("adminreg").verifySent("domain_check_fee.xml");
}
@Test