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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user