This CL include changes in the registrar console that makes it possible to designate an abuse contact in domain WHOIS record, per ICANN's CL&D requirement.

Frontend validation: ensures that only one WHOIS abuse contact exist per registrar. Any existing WHOIS abuse contact will be overridden when a new one is designated.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155289097
This commit is contained in:
jianglai 2017-05-06 10:10:10 -07:00 committed by Ben McIlwain
parent 275d6ddc10
commit 2846f9c6b9
6 changed files with 162 additions and 9 deletions

View file

@ -128,4 +128,55 @@ public class ContactSettingsTest extends RegistrarSettingsActionTestCase {
assertThat(response).containsEntry("message", "Please provide a phone number for at least one "
+ RegistrarContact.Type.TECH.getDisplayName() + " contact");
}
@Test
public void testPost_updateContacts_cannotRemoveWhoisAbuseContact_error() throws Exception {
// First make the contact's info visible in whois as abuse contact info.
Registrar registrar = Registrar.loadByClientId(CLIENT_ID);
RegistrarContact rc =
AppEngineRule.makeRegistrarContact2()
.asBuilder()
.setVisibleInDomainWhoisAsAbuse(true)
.build();
// Lest we anger the timestamp inversion bug.
persistResource(registrar);
persistSimpleResource(rc);
// Now try to remove the contact.
rc = rc.asBuilder().setVisibleInDomainWhoisAsAbuse(false).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", "An abuse contact visible in domain WHOIS query must be designated");
}
@Test
public void testPost_updateContacts_whoisAbuseContactMustHavePhoneNumber_error()
throws Exception {
// First make the contact's info visible in whois as abuse contact info.
Registrar registrar = Registrar.loadByClientId(CLIENT_ID);
RegistrarContact rc =
AppEngineRule.makeRegistrarContact2()
.asBuilder()
.setVisibleInDomainWhoisAsAbuse(true)
.build();
// Lest we anger the timestamp inversion bug.
persistResource(registrar);
persistSimpleResource(rc);
// Now try to set the phone number to null.
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", "The abuse contact visible in domain WHOIS query must have a phone number");
}
}