Make name and address fields required on Registrar

The absence of these fields causes RDE failures, so they are in effect
required on any functioning registry system. We are currently
experiencing problems in sandbox caused by null values on these fields.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155474895
This commit is contained in:
mcilwain 2017-05-09 00:27:41 -07:00 committed by Ben McIlwain
parent 5313ca58d6
commit ef1487cb57
18 changed files with 460 additions and 272 deletions

View file

@ -22,6 +22,7 @@ import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEE
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.deleteResource;
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
import static org.joda.time.DateTimeZone.UTC;
@ -94,13 +95,7 @@ public class SyncRegistrarsSheetTest {
@Test
public void test_wereRegistrarsModified_atDifferentCursorTimes() throws Exception {
persistResource(new Registrar.Builder()
.setClientId("SomeRegistrar")
.setRegistrarName("Some Registrar Inc.")
.setType(Registrar.Type.REAL)
.setIanaIdentifier(8L)
.setState(Registrar.State.ACTIVE)
.build());
persistNewRegistrar("SomeRegistrar", "Some Registrar Inc.", Registrar.Type.REAL, 8L);
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().minusHours(1)));
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isTrue();
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().plusHours(1)));
@ -327,18 +322,14 @@ public class SyncRegistrarsSheetTest {
@Test
public void testRun_missingValues_stillWorks() throws Exception {
persistResource(new Registrar.Builder()
.setClientId("SomeRegistrar")
.setType(Registrar.Type.REAL)
.setIanaIdentifier(8L)
.build());
persistNewRegistrar("SomeRegistrar", "Some Registrar", Registrar.Type.REAL, 8L);
newSyncRegistrarsSheet().run("foobar");
verify(sheetSynchronizer).synchronize(eq("foobar"), rowsCaptor.capture());
ImmutableMap<String, String> row = getOnlyElement(getOnlyElement(rowsCaptor.getAllValues()));
assertThat(row).containsEntry("clientIdentifier", "SomeRegistrar");
assertThat(row).containsEntry("registrarName", "");
assertThat(row).containsEntry("registrarName", "Some Registrar");
assertThat(row).containsEntry("state", "");
assertThat(row).containsEntry("ianaIdentifier", "8");
assertThat(row).containsEntry("billingIdentifier", "");
@ -352,8 +343,8 @@ public class SyncRegistrarsSheetTest {
assertThat(row).containsEntry("contactsMarkedAsWhoisAdmin", "");
assertThat(row).containsEntry("contactsMarkedAsWhoisTech", "");
assertThat(row).containsEntry("emailAddress", "");
assertThat(row).containsEntry("address.street", "UNKNOWN");
assertThat(row).containsEntry("address.city", "UNKNOWN");
assertThat(row).containsEntry("address.street", "123 Fake St");
assertThat(row).containsEntry("address.city", "Fakington");
assertThat(row).containsEntry("address.state", "");
assertThat(row).containsEntry("address.zip", "");
assertThat(row).containsEntry("address.countryCode", "US");