-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from pedes/ImproveTestCoverageForPasswordChan…
…geTicket Add test case for PasswordChangeTicket with Email
- Loading branch information
Showing
1 changed file
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
|
@@ -41,4 +61,4 @@ public void shouldIncludeReadOnlyValuesOnDeserialize() throws Exception { | |
assertThat(ticket.getTicket(), is("https://page.auth0.com/tickets/123")); | ||
} | ||
|
||
} | ||
} |