KEYCLOAK-8138 Fixed tests for product profile
This commit is contained in:
parent
36837ae4b6
commit
d37eb5d10b
3 changed files with 24 additions and 17 deletions
|
@ -23,6 +23,7 @@ import org.junit.Test;
|
||||||
import org.keycloak.admin.client.Keycloak;
|
import org.keycloak.admin.client.Keycloak;
|
||||||
import org.keycloak.authorization.model.Resource;
|
import org.keycloak.authorization.model.Resource;
|
||||||
import org.keycloak.client.admin.cli.util.ConfigUtil;
|
import org.keycloak.client.admin.cli.util.ConfigUtil;
|
||||||
|
import org.keycloak.common.Profile;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.*;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.authorization.ClientPolicyRepresentation;
|
import org.keycloak.representations.idm.authorization.ClientPolicyRepresentation;
|
||||||
|
@ -41,6 +42,7 @@ import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.representations.idm.authorization.DecisionStrategy;
|
import org.keycloak.representations.idm.authorization.DecisionStrategy;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
|
import org.keycloak.testsuite.ProfileAssume;
|
||||||
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
||||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
||||||
|
@ -856,6 +858,7 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWithTokenExchange() throws Exception {
|
public void testWithTokenExchange() throws Exception {
|
||||||
|
ProfileAssume.assumeFeatureEnabled(Profile.Feature.TOKEN_EXCHANGE);
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
RealmModel realm = session.realms().getRealmByName("master");
|
RealmModel realm = session.realms().getRealmByName("master");
|
||||||
ClientModel client = session.realms().getClientByClientId("kcinit", realm);
|
ClientModel client = session.realms().getClientByClientId("kcinit", realm);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.keycloak.authentication.authenticators.console.ConsoleUsernamePasswor
|
||||||
import org.keycloak.authentication.requiredactions.TermsAndConditions;
|
import org.keycloak.authentication.requiredactions.TermsAndConditions;
|
||||||
import org.keycloak.authorization.model.Policy;
|
import org.keycloak.authorization.model.Policy;
|
||||||
import org.keycloak.authorization.model.ResourceServer;
|
import org.keycloak.authorization.model.ResourceServer;
|
||||||
|
import org.keycloak.common.Profile;
|
||||||
import org.keycloak.credential.CredentialModel;
|
import org.keycloak.credential.CredentialModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.*;
|
||||||
import org.keycloak.models.utils.DefaultAuthenticationFlows;
|
import org.keycloak.models.utils.DefaultAuthenticationFlows;
|
||||||
|
@ -404,6 +405,7 @@ public class KcinitTest extends AbstractTestRealmKeycloakTest {
|
||||||
Assert.assertEquals(0, exe.exitCode());
|
Assert.assertEquals(0, exe.exitCode());
|
||||||
Assert.assertEquals(0, exe.stdoutLines().size());
|
Assert.assertEquals(0, exe.stdoutLines().size());
|
||||||
|
|
||||||
|
if (Profile.isFeatureEnabled(Profile.Feature.TOKEN_EXCHANGE)) {
|
||||||
exe = KcinitExec.execute("token");
|
exe = KcinitExec.execute("token");
|
||||||
Assert.assertEquals(0, exe.exitCode());
|
Assert.assertEquals(0, exe.exitCode());
|
||||||
Assert.assertEquals(1, exe.stdoutLines().size());
|
Assert.assertEquals(1, exe.stdoutLines().size());
|
||||||
|
@ -423,6 +425,7 @@ public class KcinitTest extends AbstractTestRealmKeycloakTest {
|
||||||
Assert.assertEquals(0, exe.stdoutLines().size());
|
Assert.assertEquals(0, exe.stdoutLines().size());
|
||||||
Assert.assertEquals(1, exe.stderrLines().size());
|
Assert.assertEquals(1, exe.stderrLines().size());
|
||||||
Assert.assertTrue(exe.stderrLines().get(0), exe.stderrLines().get(0).contains("failed to exchange token: invalid_client Audience not found"));
|
Assert.assertTrue(exe.stderrLines().get(0), exe.stderrLines().get(0).contains("failed to exchange token: invalid_client Audience not found"));
|
||||||
|
}
|
||||||
|
|
||||||
exe = KcinitExec.execute("logout");
|
exe = KcinitExec.execute("logout");
|
||||||
Assert.assertEquals(0, exe.exitCode());
|
Assert.assertEquals(0, exe.exitCode());
|
||||||
|
|
|
@ -39,7 +39,8 @@ public class ThemeSelectorTest extends AbstractTestRealmKeycloakTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String detectTheme() {
|
private String detectTheme() {
|
||||||
if(driver.getPageSource().contains("/login/keycloak/css/login.css")) {
|
// for the purpose of the test does not matter which profile is used (product or community)
|
||||||
|
if(driver.getPageSource().contains("/login/keycloak/css/login.css") || driver.getPageSource().contains("/login/rh-sso/css/login.css")) {
|
||||||
return "keycloak";
|
return "keycloak";
|
||||||
} else {
|
} else {
|
||||||
return "base";
|
return "base";
|
||||||
|
|
Loading…
Reference in a new issue