mirror of
https://github.com/google/nomulus.git
synced 2025-08-02 07:52:11 +02:00
Automated g4 rollback of changelist 240574585.
*** Reason for rollback *** The inconsistent class loading is breaking the tests *** Original change description *** Validate provided email addresses when creating a Registrar *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=241014945
This commit is contained in:
parent
315be3eab0
commit
25f1d58969
10 changed files with 24 additions and 137 deletions
|
@ -405,27 +405,6 @@ public final class ConsoleRegistrarCreatorActionTest {
|
|||
assertThat(registrar.getPhonePasscode()).isEqualTo("10203");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPost_badEmailFails() {
|
||||
action.clientId = Optional.of("myclientid");
|
||||
action.name = Optional.of("registrar name");
|
||||
action.billingAccount = Optional.of("USD=billing-account");
|
||||
action.ianaId = Optional.of(12321);
|
||||
action.referralEmail = Optional.of("lolcat");
|
||||
action.driveId = Optional.of("drive-id");
|
||||
action.consoleUserEmail = Optional.of("myclientid@registry.example");
|
||||
|
||||
action.street1 = Optional.of("my street");
|
||||
action.city = Optional.of("my city");
|
||||
action.countryCode = Optional.of("CC");
|
||||
|
||||
action.method = Method.POST;
|
||||
action.run();
|
||||
|
||||
assertThat(response.getPayload())
|
||||
.contains("Failed: Provided email lolcat is not a valid email address");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPost_unauthorized() {
|
||||
action.registrarAccessor =
|
||||
|
|
|
@ -149,6 +149,24 @@ 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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue