Fix disabled feature tests

This commit is contained in:
Dmitry Telegin 2024-02-22 02:02:08 -06:00 committed by Pedro Igor
parent 87c2df0ea4
commit 6a57614554
2 changed files with 5 additions and 5 deletions

View file

@ -219,7 +219,7 @@ public class BrokerLinkAndTokenExchangeTest extends AbstractServletsAdapterTest
@DisableFeature(value = Profile.Feature.TOKEN_EXCHANGE, skipRestart = true)
@UncaughtServerErrorExpected
public void testFeatureDisabled() throws Exception {
checkFeature(Response.Status.NOT_IMPLEMENTED.getStatusCode());
checkFeature(Response.Status.BAD_REQUEST.getStatusCode());
}
@Test
@ -863,7 +863,7 @@ public class BrokerLinkAndTokenExchangeTest extends AbstractServletsAdapterTest
private void checkFeature(int statusCode) throws Exception {
String accessToken = oauth.doGrantAccessTokenRequest(PARENT_IDP, PARENT2_USERNAME, "password", null, PARENT_CLIENT, "password").getAccessToken();
if (statusCode != Response.Status.NOT_IMPLEMENTED.getStatusCode()) {
if (statusCode != Response.Status.BAD_REQUEST.getStatusCode()) {
Assert.assertEquals(0, adminClient.realm(CHILD_IDP).getClientSessionStats().size());
}
@ -888,7 +888,7 @@ public class BrokerLinkAndTokenExchangeTest extends AbstractServletsAdapterTest
));
Assert.assertEquals(statusCode, response.getStatus());
if (statusCode != Response.Status.NOT_IMPLEMENTED.getStatusCode()) {
if (statusCode != Response.Status.BAD_REQUEST.getStatusCode()) {
AccessTokenResponse tokenResponse = response.readEntity(AccessTokenResponse.class);
String idToken = tokenResponse.getIdToken();
Assert.assertNotNull(idToken);

View file

@ -95,9 +95,9 @@ public class ClientTokenExchangeTest extends AbstractKeycloakTest {
@UncaughtServerErrorExpected
@DisableFeature(value = Profile.Feature.TOKEN_EXCHANGE, skipRestart = true)
public void checkFeatureDisabled() {
// Required feature should return Status code 501 - Feature doesn't work
// Required feature should return Status code 400 - Feature doesn't work
testingClient.server().run(ClientTokenExchangeTest::addDirectExchanger);
Assert.assertEquals(501, checkTokenExchange().getStatus());
Assert.assertEquals(400, checkTokenExchange().getStatus());
testingClient.server().run(ClientTokenExchangeTest::removeDirectExchanger);
}