mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 03:06:01 +02:00
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:
parent
275d6ddc10
commit
2846f9c6b9
6 changed files with 162 additions and 9 deletions
|
@ -142,7 +142,7 @@ function testItemEditButtons() {
|
|||
function testItemEdit() {
|
||||
testItemView();
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
document.forms.namedItem('item').elements['contacts[0].name'].value = 'bob';
|
||||
$('contacts[0].name').setAttribute('value', 'bob');
|
||||
registry.testing.click($('reg-app-btn-save'));
|
||||
testContact.name = 'bob';
|
||||
registry.testing.assertReqMockRsp(
|
||||
|
@ -248,6 +248,36 @@ function testOneOfManyUpdate() {
|
|||
}
|
||||
|
||||
|
||||
function testDomainWhoisAbuseContactOverride() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-settings/test@example.com',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
testClientId: test.testClientId
|
||||
});
|
||||
var oldDomainWhoisAbuseContact = createTestContact('old@asdf.com');
|
||||
oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = true;
|
||||
var testContacts = [oldDomainWhoisAbuseContact, testContact];
|
||||
registry.testing.assertReqMockRsp(
|
||||
test.testXsrfToken, '/registrar-settings', {op: 'read', args: {}},
|
||||
{status: 'SUCCESS', message: 'OK', results: [{contacts: testContacts}]});
|
||||
// Edit testContact.
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
$('contacts[1].visibleInDomainWhoisAsAbuse.true')
|
||||
.setAttribute('checked', 'checked');
|
||||
$('contacts[1].visibleInDomainWhoisAsAbuse.false').removeAttribute('checked');
|
||||
registry.testing.click($('reg-app-btn-save'));
|
||||
|
||||
// Should save them all back, and flip the old abuse contact's visibility
|
||||
// boolean.
|
||||
testContact.visibleInDomainWhoisAsAbuse = true;
|
||||
oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = false;
|
||||
registry.testing.assertReqMockRsp(
|
||||
test.testXsrfToken, '/registrar-settings',
|
||||
{op: 'update', args: {contacts: testContacts, readonly: false}},
|
||||
{status: 'SUCCESS', message: 'OK', results: [{contacts: testContacts}]});
|
||||
}
|
||||
|
||||
|
||||
function testDelete() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-settings/test@example.com',
|
||||
|
@ -305,6 +335,7 @@ function createTestContact(opt_email) {
|
|||
faxNumber: '+1.2345551234',
|
||||
visibleInWhoisAsAdmin: false,
|
||||
visibleInWhoisAsTech: false,
|
||||
visibleInDomainWhoisAsAbuse: false,
|
||||
types: 'ADMIN'
|
||||
};
|
||||
}
|
||||
|
@ -318,6 +349,7 @@ function createTestContact(opt_email) {
|
|||
function simulateJsonForContact(contact) {
|
||||
contact.visibleInWhoisAsAdmin = contact.visibleInWhoisAsAdmin == 'true';
|
||||
contact.visibleInWhoisAsTech = contact.visibleInWhoisAsTech == 'true';
|
||||
contact.visibleInDomainWhoisAsAbuse = contact.visibleInDomainWhoisAsAbuse == 'true';
|
||||
contact.types = '';
|
||||
for (var tNdx in contact.type) {
|
||||
if (contact.type[tNdx]) {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue