Skip to content

Commit

Permalink
Merge pull request #187 from pedes/ImproveTestCoverageForPasswordChan…
Browse files Browse the repository at this point in the history
…geTicket

Add test case for PasswordChangeTicket with Email
  • Loading branch information
lbalmaceda committed Apr 23, 2019
2 parents d3c24db + a6ab8e1 commit 57e9024
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ public void shouldSerialize() throws Exception {
assertThat(serialized, JsonMatcher.hasEntry("mark_email_as_verified", true));
}


@Test
public void shouldSerializeWithCustomizedConnection() throws Exception {
PasswordChangeTicket ticket = new PasswordChangeTicket("[email protected]", "connid123");
ticket.setResultUrl("https://page.auth0.com/result");
ticket.setTTLSeconds(36000);
ticket.setEmail("[email protected]");
ticket.setNewPassword("pass123");
ticket.setUserId("usr123");

String serialized = toJSON(ticket);
assertThat(serialized, is(notNullValue()));
assertThat(serialized, JsonMatcher.hasEntry("user_id", "usr123"));
assertThat(serialized, JsonMatcher.hasEntry("result_url", "https://page.auth0.com/result"));
assertThat(serialized, JsonMatcher.hasEntry("ttl_sec", 36000));
assertThat(serialized, JsonMatcher.hasEntry("new_password", "pass123"));
assertThat(serialized, JsonMatcher.hasEntry("connection_id", "connid123"));
assertThat(serialized, JsonMatcher.hasEntry("email", "[email protected]"));
}

@Test
public void shouldIncludeReadOnlyValuesOnDeserialize() throws Exception {
PasswordChangeTicket ticket = fromJSON(readOnlyJson, PasswordChangeTicket.class);
Expand All @@ -41,4 +61,4 @@ public void shouldIncludeReadOnlyValuesOnDeserialize() throws Exception {
assertThat(ticket.getTicket(), is("https://page.auth0.com/tickets/123"));
}

}
}

0 comments on commit 57e9024

Please sign in to comment.