mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 02:06:00 +02:00
Add ability to show full WHOIS output in nomulus command
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=197731992
This commit is contained in:
parent
ac500652ac
commit
86dd6bd59e
15 changed files with 181 additions and 62 deletions
|
@ -255,7 +255,7 @@ public class DomainWhoisResponseTest {
|
|||
@Test
|
||||
public void getPlainTextOutputTest() {
|
||||
DomainWhoisResponse domainWhoisResponse =
|
||||
new DomainWhoisResponse(domainResource, clock.nowUtc());
|
||||
new DomainWhoisResponse(domainResource, false, clock.nowUtc());
|
||||
assertThat(
|
||||
domainWhoisResponse.getResponse(
|
||||
false,
|
||||
|
@ -263,11 +263,22 @@ public class DomainWhoisResponseTest {
|
|||
.isEqualTo(WhoisResponseResults.create(loadFile("whois_domain.txt"), 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPlainTextOutputTest_fullOutput() {
|
||||
DomainWhoisResponse domainWhoisResponse =
|
||||
new DomainWhoisResponse(domainResource, true, clock.nowUtc());
|
||||
assertThat(
|
||||
domainWhoisResponse.getResponse(
|
||||
false,
|
||||
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
|
||||
.isEqualTo(WhoisResponseResults.create(loadFile("whois_domain_full_output.txt"), 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addImplicitOkStatusTest() {
|
||||
DomainWhoisResponse domainWhoisResponse =
|
||||
new DomainWhoisResponse(
|
||||
domainResource.asBuilder().setStatusValues(null).build(), clock.nowUtc());
|
||||
domainResource.asBuilder().setStatusValues(null).build(), false, clock.nowUtc());
|
||||
assertThat(
|
||||
domainWhoisResponse
|
||||
.getResponse(
|
||||
|
|
|
@ -554,7 +554,7 @@ public class WhoisActionTest {
|
|||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||
WhoisAction action = newWhoisAction("ns1.cat.lol");
|
||||
action.whoisReader = mock(WhoisReader.class);
|
||||
when(action.whoisReader.readCommand(any(Reader.class), any(DateTime.class)))
|
||||
when(action.whoisReader.readCommand(any(Reader.class), eq(false), any(DateTime.class)))
|
||||
.thenThrow(new IOException("missing cat interface"));
|
||||
action.whoisMetrics = mock(WhoisMetrics.class);
|
||||
|
||||
|
@ -574,11 +574,15 @@ public class WhoisActionTest {
|
|||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||
WhoisAction action = newWhoisAction("ns1.cat.lol");
|
||||
WhoisResponse expectedResponse =
|
||||
action.whoisReader.readCommand(action.input, clock.nowUtc()).executeQuery(clock.nowUtc());
|
||||
action
|
||||
.whoisReader
|
||||
.readCommand(action.input, false, clock.nowUtc())
|
||||
.executeQuery(clock.nowUtc());
|
||||
|
||||
WhoisReader mockReader = mock(WhoisReader.class);
|
||||
WhoisCommand mockCommand = mock(WhoisCommand.class);
|
||||
when(mockReader.readCommand(any(Reader.class), any(DateTime.class))).thenReturn(mockCommand);
|
||||
when(mockReader.readCommand(any(Reader.class), eq(false), any(DateTime.class)))
|
||||
.thenReturn(mockCommand);
|
||||
when(mockCommand.executeQuery(any(DateTime.class)))
|
||||
.thenThrow(new DatastoreFailureException("Expected transient exception #1"))
|
||||
.thenThrow(new DatastoreTimeoutException("Expected transient exception #2"))
|
||||
|
|
|
@ -358,7 +358,7 @@ public class WhoisHttpActionTest {
|
|||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||
WhoisHttpAction action = newWhoisHttpAction("ns1.cat.lol");
|
||||
action.whoisReader = mock(WhoisReader.class);
|
||||
when(action.whoisReader.readCommand(any(Reader.class), any(DateTime.class)))
|
||||
when(action.whoisReader.readCommand(any(Reader.class), eq(false), any(DateTime.class)))
|
||||
.thenThrow(new IOException("missing cat interface"));
|
||||
action.whoisMetrics = mock(WhoisMetrics.class);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class WhoisReaderTest {
|
|||
<T> T readCommand(String commandStr) throws Exception {
|
||||
return (T)
|
||||
new WhoisReader(new WhoisCommandFactory())
|
||||
.readCommand(new StringReader(commandStr), clock.nowUtc());
|
||||
.readCommand(new StringReader(commandStr), false, clock.nowUtc());
|
||||
}
|
||||
|
||||
void assertLoadsExampleTld(String commandString) throws Exception {
|
||||
|
|
66
javatests/google/registry/whois/testdata/whois_domain_full_output.txt
vendored
Normal file
66
javatests/google/registry/whois/testdata/whois_domain_full_output.txt
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
Domain Name: example.tld
|
||||
Registry Domain ID: 3-TLD
|
||||
Registrar WHOIS Server: whois.nic.fakewhois.example
|
||||
Registrar URL: http://my.fake.url
|
||||
Updated Date: 2009-05-29T20:13:00Z
|
||||
Creation Date: 2000-10-08T00:45:00Z
|
||||
Registry Expiry Date: 2010-10-08T00:44:59Z
|
||||
Registrar: New Registrar
|
||||
Registrar IANA ID: 5555555
|
||||
Registrar Abuse Contact Email: jakedoe@theregistrar.com
|
||||
Registrar Abuse Contact Phone: +1.2125551216
|
||||
Domain Status: addPeriod https://icann.org/epp#addPeriod
|
||||
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
|
||||
Domain Status: clientRenewProhibited https://icann.org/epp#clientRenewProhibited
|
||||
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
|
||||
Domain Status: serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited
|
||||
Domain Status: transferPeriod https://icann.org/epp#transferPeriod
|
||||
Registry Registrant ID: 4-TLD
|
||||
Registrant Name: EXAMPLE REGISTRANT
|
||||
Registrant Organization: Tom & Jerry Corp.
|
||||
Registrant Street: 123 EXAMPLE STREET
|
||||
Registrant City: ANYTOWN
|
||||
Registrant State/Province: AP
|
||||
Registrant Postal Code: A1A1A1
|
||||
Registrant Country: EX
|
||||
Registrant Phone: +1.5555551212
|
||||
Registrant Phone Ext: 1234
|
||||
Registrant Fax: +1.5555551213
|
||||
Registrant Fax Ext: 4321
|
||||
Registrant Email: EMAIL@EXAMPLE.tld
|
||||
Registry Admin ID: 5-TLD
|
||||
Admin Name: EXAMPLE REGISTRANT ADMINISTRATIVE
|
||||
Admin Organization: EXAMPLE REGISTRANT ORGANIZATION
|
||||
Admin Street: 123 EXAMPLE STREET
|
||||
Admin City: ANYTOWN
|
||||
Admin State/Province: AP
|
||||
Admin Postal Code: A1A1A1
|
||||
Admin Country: EX
|
||||
Admin Phone: +1.5555551212
|
||||
Admin Phone Ext: 1234
|
||||
Admin Fax: +1.5555551213
|
||||
Admin Email: EMAIL@EXAMPLE.tld
|
||||
Registry Tech ID: 6-TLD
|
||||
Tech Name: EXAMPLE REGISTRAR TECHNICAL
|
||||
Tech Organization: EXAMPLE REGISTRAR LLC
|
||||
Tech Street: 123 EXAMPLE STREET
|
||||
Tech City: ANYTOWN
|
||||
Tech State/Province: AP
|
||||
Tech Postal Code: A1A1A1
|
||||
Tech Country: EX
|
||||
Tech Phone: +1.1235551234
|
||||
Tech Phone Ext: 1234
|
||||
Tech Fax: +1.5555551213
|
||||
Tech Fax Ext: 93
|
||||
Tech Email: EMAIL@EXAMPLE.tld
|
||||
Name Server: ns01.exampleregistrar.tld
|
||||
Name Server: ns02.exampleregistrar.tld
|
||||
DNSSEC: signedDelegation
|
||||
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
||||
|
||||
For more information on Whois status codes, please visit https://icann.org/epp
|
||||
|
||||
Doodle Disclaimer
|
||||
I exist so that carriage return
|
||||
in disclaimer can be tested.
|
Loading…
Add table
Add a link
Reference in a new issue