Add arity to registrar_request boolean flags (#3168)

Define arity 1 on requestedByRegistrar options in BulkDomainTransferCommand
and DeleteDomainCommand to accept explicit false arguments without parsing
failures. Up-to-date tests verify space-separated and equals argument syntax.

BUG= http://b/537308816
This commit is contained in:
Ben McIlwain
2026-07-24 14:26:34 +00:00
committed by GitHub
parent 53b6044ff8
commit 7347dbf762
4 changed files with 43 additions and 3 deletions
@@ -88,7 +88,8 @@ public class BulkDomainTransferCommand extends ConfirmingCommand implements Comm
@Parameter(
names = {"--registrar_request"},
description = "Whether the change was requested by a registrar.")
description = "Whether the change was requested by a registrar.",
arity = 1)
private boolean requestedByRegistrar = false;
@Parameter(
@@ -52,7 +52,8 @@ final class DeleteDomainCommand extends MutatingEppToolCommand {
@Parameter(
names = {"--registrar_request"},
description = "Whether the change was requested by a registrar.")
description = "Whether the change was requested by a registrar.",
arity = 1)
private boolean requestedByRegistrar = false;
@Override
@@ -165,4 +165,32 @@ public class BulkDomainTransferCommandTest extends CommandTestCase<BulkDomainTra
.isEqualTo(
"Must specify exactly one input method, either --domains or --domain_names_file");
}
@Test
void testSuccess_registrarRequestExplicit() throws Exception {
runCommandForced(
"--gaining_registrar_id",
"NewRegistrar",
"--losing_registrar_id",
"TheRegistrar",
"--reason",
"someReason",
"--domains",
"foo.tld,bar.tld",
"--registrar_request=false");
verify(connection)
.sendPostRequest(
"/_dr/task/bulkDomainTransfer",
ImmutableMap.of(
"gainingRegistrarId",
"NewRegistrar",
"losingRegistrarId",
"TheRegistrar",
"requestedByRegistrar",
false,
"reason",
"someReason"),
MediaType.PLAIN_TEXT_UTF_8,
"[\"foo.tld\",\"bar.tld\"]".getBytes(UTF_8));
}
}
@@ -53,10 +53,20 @@ class DeleteDomainCommandTest extends EppToolCommandTestCase<DeleteDomainCommand
"--client=NewRegistrar",
"--domain_name=example.tld",
"--reason=Test",
"--registrar_request");
"--registrar_request=true");
eppVerifier.verifySent("domain_delete_by_registrar.xml");
}
@Test
void testSuccess_requestedByRegistrarExplicitFalse() throws Exception {
runCommandForced(
"--client=NewRegistrar",
"--domain_name=example.tld",
"--reason=Test",
"--registrar_request=false");
eppVerifier.verifySent("domain_delete.xml");
}
@Test
void testFailure_noReason() {
assertThrows(