1
0
mirror of https://github.com/google/nomulus synced 2026-01-08 23:23:32 +00:00

make transitionId a required parameter (#1083)

This commit is contained in:
Rachel Guan
2021-04-15 10:42:15 -04:00
committed by GitHub
parent 2161e46a4b
commit fbef643488
2 changed files with 12 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ public class SetDatabaseTransitionScheduleCommand extends MutatingCommand {
@Parameter(
names = "--transition_id",
required = true,
description = "Transition id string for the schedule being updated")
private TransitionId transitionId;

View File

@@ -20,7 +20,9 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.persistence.transaction.TransactionManagerFactory.ofyTm;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.junit.jupiter.api.Assertions.assertThrows;
import com.beust.jcommander.ParameterException;
import com.google.common.collect.ImmutableSortedMap;
import com.googlecode.objectify.Key;
import google.registry.model.common.DatabaseTransitionSchedule;
@@ -45,6 +47,15 @@ public class SetDatabaseTransitionScheduleCommandTest
fakeClock.setTo(DateTime.parse("2020-12-01T00:00:00Z"));
}
@Test
void testFailure_noTransitionId() throws Exception {
ParameterException thrown =
assertThrows(
ParameterException.class,
() -> runCommandForced("--transition_schedule=2021-04-14T00:00:00.000Z=DATASTORE"));
assertThat(thrown).hasMessageThat().contains("--transition_id");
}
@Test
void testSuccess_currentScheduleIsEmpty() throws Exception {
assertThat(ofy().load().key(key).now()).isNull();