Skip to content

Commit

Permalink
fix: fixing test after changing error response
Browse files Browse the repository at this point in the history
  • Loading branch information
tamassoltesz committed Aug 5, 2024
1 parent 20ed895 commit 4b2fcbd
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.supertokens.test.Utils;
import io.supertokens.test.httpRequest.HttpRequestForTesting;
import io.supertokens.test.httpRequest.HttpResponseException;
import jakarta.servlet.ServletException;
import org.junit.*;
import org.junit.rules.TestRule;

Expand Down Expand Up @@ -383,12 +384,13 @@ public void testClientUpdatePatch_hydraErrortResultsInError()
requestBody.addProperty(propToChangeKey, newValue);
requestBody.add(notAlistPropToChange, newListValue);

JsonObject response = HttpRequestForTesting.sendJsonPATCHRequest(process.getProcess(),
"http://localhost:3567/recipe/oauth/clients", requestBody);
HttpResponseException expected = assertThrows(HttpResponseException.class, () -> {
HttpRequestForTesting.sendJsonPATCHRequest(process.getProcess(),
"http://localhost:3567/recipe/oauth/clients", requestBody);
});

assertEquals("OAUTH2_CLIENT_UPDATE_ERROR", response.get("status").getAsString());
assertEquals("error", response.get("error").getAsString());
assertEquals("The error is unrecognizable", response.get("errorDescription").getAsString());
assertEquals("Http error. Status Code: 500. Message: Internal Error\n", expected.getMessage());
assertEquals(500, expected.statusCode);

process.kill();
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STOPPED));
Expand Down

0 comments on commit 4b2fcbd

Please sign in to comment.