mirror of
https://github.com/google/nomulus.git
synced 2025-08-06 01:35:17 +02:00
Fix registrar security console
The registrar security console failed because it assumed the email is a required field for the registrar, but it isn't (at least - create_registrar doesn't require an email, and update_registrar lets you remove the email). Fixed by allowing it to *remain* unset if it was unset originally, but if it was set - it's required. There are more fixes needed, but they aren't related to the email, so they will wait for the next CL ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=191623034
This commit is contained in:
parent
e816913c61
commit
ea891001d9
7 changed files with 44 additions and 14 deletions
|
@ -16,6 +16,7 @@ package google.registry.ui.server.registrar;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
|
@ -98,6 +99,16 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
|||
assertNoTasksEnqueued("sheet");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_emptyJsonObject_emailFieldNotRequiredWhenEmpty() throws Exception {
|
||||
persistResource(loadRegistrar(CLIENT_ID).asBuilder().setEmailAddress(null).build());
|
||||
|
||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||
"op", "update",
|
||||
"args", ImmutableMap.of()));
|
||||
assertThat(response).containsEntry("status", "SUCCESS");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate_badEmail_errorEmailField() throws Exception {
|
||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue