Make driveFolderId on Registry entity optional

This defaults to null, and leaving it to null now simply disables reserved terms
exporting, rather than throwing an error every time the action runs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138763161
This commit is contained in:
mcilwain 2016-11-10 08:25:23 -08:00 committed by Ben McIlwain
parent 9122372e38
commit 274b070b54
3 changed files with 14 additions and 11 deletions

View file

@ -110,15 +110,12 @@ public class ExportReservedTermsActionTest {
}
@Test
public void test_uploadFileToDrive_failsWhenDriveFolderIdIsNull() throws Exception {
public void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() throws Exception {
persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build());
try {
runAction("tld");
assertWithMessage("Expected RuntimeException to be thrown").fail();
} catch (RuntimeException e) {
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
assertThat(getRootCause(e)).hasMessage("No drive folder associated with this TLD");
}
runAction("tld");
verify(response).setStatus(SC_OK);
verify(response)
.setPayload("Skipping export because no Drive folder is associated with this TLD");
}
@Test