Skip to content

Commit d77e212

Browse files
committed
Added test cases
1 parent 2475bf1 commit d77e212

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/test/java/com/auth0/client/auth/AuthAPITest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,28 @@ public void shouldCreateResetPasswordRequestWithSpecifiedClientId() throws Excep
328328
assertThat(response, is(nullValue()));
329329
}
330330

331+
@Test
332+
public void shouldCreateResetPasswordRequestWithSpecifiedClientIdWithOrganization() throws Exception {
333+
Request<Void> request = api.resetPassword("CLIENT-ID", "me@auth0.com", "db-connection", "ORGANIZATION-ID");
334+
assertThat(request, is(notNullValue()));
335+
336+
server.jsonResponse(AUTH_RESET_PASSWORD, 200);
337+
Void response = request.execute().getBody();
338+
RecordedRequest recordedRequest = server.takeRequest();
339+
340+
assertThat(recordedRequest, hasMethodAndPath(HttpMethod.POST, "/dbconnections/change_password"));
341+
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
342+
343+
Map<String, Object> body = bodyFromRequest(recordedRequest);
344+
assertThat(body, hasEntry("email", "me@auth0.com"));
345+
assertThat(body, hasEntry("connection", "db-connection"));
346+
assertThat(body, hasEntry("client_id", "CLIENT-ID"));
347+
assertThat(body, hasEntry("organization", "ORGANIZATION-ID"));
348+
assertThat(body, not(hasKey("password")));
349+
350+
assertThat(response, is(nullValue()));
351+
}
352+
331353
//Sign Up
332354

333355
@SuppressWarnings("deprecation")

0 commit comments

Comments
 (0)