Add RDAP pretty-printing option

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176529676
This commit is contained in:
mountford 2017-11-21 10:41:01 -08:00 committed by jianglai
parent 6f659659ff
commit 67a41273bb
13 changed files with 71 additions and 9 deletions

View file

@ -123,6 +123,7 @@ public class RdapActionBaseTest {
action.authResult = AuthResult.create(AuthLevel.USER, userAuthInfo);
action.includeDeletedParam = Optional.empty();
action.registrarParam = Optional.empty();
action.formatOutputParam = Optional.empty();
action.response = response;
action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter();
action.rdapMetrics = rdapMetrics;
@ -231,4 +232,25 @@ public class RdapActionBaseTest {
.setIncompletenessWarningType(IncompletenessWarningType.COMPLETE)
.build());
}
@Test
public void testUnformatted() throws Exception {
action.requestPath = RdapTestAction.PATH + "no.thing";
action.fullServletPath = "http://myserver.example.com" + RdapTestAction.PATH;
action.requestMethod = GET;
action.run();
assertThat(response.getPayload() + '\n').isEqualTo(
loadFileWithSubstitutions(this.getClass(), "rdap_unformatted_output.json", null));
}
@Test
public void testFormatted() throws Exception {
action.requestPath = RdapTestAction.PATH + "no.thing?formatOutput=true";
action.fullServletPath = "http://myserver.example.com" + RdapTestAction.PATH;
action.requestMethod = GET;
action.formatOutputParam = Optional.of(true);
action.run();
assertThat(response.getPayload() + '\n').isEqualTo(
loadFileWithSubstitutions(this.getClass(), "rdap_formatted_output.json", null));
}
}