Validate provided email addresses when creating a Registrar

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=240574585
This commit is contained in:
gbrodman 2019-03-27 09:14:38 -07:00 committed by jianglai
parent 4240be268a
commit 308d5eb76b
10 changed files with 137 additions and 24 deletions

View file

@ -149,24 +149,6 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
assertMetric(CLIENT_ID, "update", "[OWNER]", "ERROR: FormFieldException");
}
@Test
public void testUpdate_emptyJsonObject_emailFieldNotRequiredWhenEmpty() {
persistResource(loadRegistrar(CLIENT_ID).asBuilder().setEmailAddress(null).build());
Map<String, Object> args = Maps.newHashMap(loadRegistrar(CLIENT_ID).toJsonMap());
args.remove("emailAddress");
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
"op", "update",
"id", CLIENT_ID,
"args", args));
assertThat(response).containsExactly(
"status", "SUCCESS",
"message", "Saved TheRegistrar",
"results", ImmutableList.of(loadRegistrar(CLIENT_ID).toJsonMap()));
assertMetric(CLIENT_ID, "update", "[OWNER]", "SUCCESS");
}
@Test
public void testFailure_updateRegistrarInfo_notAuthorized() {
setUserWithoutAccess();