Modify DeleteAllocationTokensCommand to have the same input structure as UpdateATC

It's dangerous to have a blank prefix delete all tokens and this allows for some code unification.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=250493453
This commit is contained in:
gbrodman 2019-05-29 08:13:01 -07:00 committed by jianglai
parent 4d4926bac7
commit 5c127b8020
5 changed files with 124 additions and 89 deletions

View file

@ -176,7 +176,7 @@ public class UpdateAllocationTokensCommandTest
IllegalArgumentException.class,
() -> runCommandForced("--prefix", "token", "--tokens", "token")))
.hasMessageThat()
.isEqualTo("Must provide one of --tokens or --prefix, not both");
.isEqualTo("Must provide one of --tokens or --prefix, not both / neither");
}
@Test
@ -185,7 +185,14 @@ public class UpdateAllocationTokensCommandTest
assertThrows(
IllegalArgumentException.class, () -> runCommandForced("--allowed_tlds", "tld")))
.hasMessageThat()
.isEqualTo("Must provide one of --tokens or --prefix, not both");
.isEqualTo("Must provide one of --tokens or --prefix, not both / neither");
}
@Test
public void testFailure_emptyPrefix() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommandForced("--prefix", ""));
assertThat(thrown).hasMessageThat().isEqualTo("Provided prefix should not be blank");
}
private static AllocationToken.Builder builderWithPromo() {