mirror of
https://github.com/google/nomulus.git
synced 2025-08-05 09:21:49 +02:00
Prevent removal of abuse contact phone number when updating registrar contact
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=153000833
This commit is contained in:
parent
f433242125
commit
478c7576c6
2 changed files with 44 additions and 6 deletions
|
@ -128,4 +128,28 @@ public class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
assertThat(response).containsEntry("message", "At least one "
|
||||
+ RegistrarContact.Type.TECH.getDisplayName() + " contact must have a phone number");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPost_updateContacts_requireAbusePhone_error() throws Exception {
|
||||
// First make the contact a abuse contact as well.
|
||||
Registrar registrar = Registrar.loadByClientId(CLIENT_ID);
|
||||
RegistrarContact rc = AppEngineRule.makeRegistrarContact2()
|
||||
.asBuilder()
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN, RegistrarContact.Type.ABUSE))
|
||||
.build();
|
||||
// Lest we anger the timestamp inversion bug.
|
||||
persistResource(registrar);
|
||||
persistSimpleResource(rc);
|
||||
|
||||
// Now try to remove the phone number.
|
||||
rc = rc.asBuilder().setPhoneNumber(null).build();
|
||||
Map<String, Object> reqJson = registrar.toJsonMap();
|
||||
reqJson.put("contacts", ImmutableList.of(rc.toJsonMap()));
|
||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||
"op", "update",
|
||||
"args", reqJson));
|
||||
assertThat(response).containsEntry("status", "ERROR");
|
||||
assertThat(response).containsEntry("message", "At least one "
|
||||
+ RegistrarContact.Type.ABUSE.getDisplayName() + " contact must have a phone number");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue