Merge pull request #4403 from mhajas/KEYCLOAK-5313

KEYCLOAK-5313 Assume preview profile for InstallationTests
This commit is contained in:
Pavel Drozd 2017-08-28 10:28:13 +02:00 committed by GitHub
commit 53fe96db78

View file

@ -19,8 +19,10 @@ package org.keycloak.testsuite.admin.client;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.keycloak.admin.client.resource.ClientResource; import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher; import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
@ -52,11 +54,9 @@ public class InstallationTest extends AbstractClientTest {
public void createClients() { public void createClients() {
oidcClientId = createOidcClient(OIDC_NAME); oidcClientId = createOidcClient(OIDC_NAME);
oidcBearerOnlyClientId = createOidcBearerOnlyClient(OIDC_NAME_BEARER_ONLY_NAME); oidcBearerOnlyClientId = createOidcBearerOnlyClient(OIDC_NAME_BEARER_ONLY_NAME);
oidcBearerOnlyClientWithAuthzId = createOidcBearerOnlyClientWithAuthz(OIDC_NAME_BEARER_ONLY_WITH_AUTHZ_NAME);
oidcClient = findClientResource(OIDC_NAME); oidcClient = findClientResource(OIDC_NAME);
oidcBearerOnlyClient = findClientResource(OIDC_NAME_BEARER_ONLY_NAME); oidcBearerOnlyClient = findClientResource(OIDC_NAME_BEARER_ONLY_NAME);
oidcBearerOnlyClientWithAuthz = findClientResource(OIDC_NAME_BEARER_ONLY_WITH_AUTHZ_NAME);
samlClientId = createSamlClient(SAML_NAME); samlClientId = createSamlClient(SAML_NAME);
samlClient = findClientResource(SAML_NAME); samlClient = findClientResource(SAML_NAME);
@ -66,7 +66,6 @@ public class InstallationTest extends AbstractClientTest {
public void tearDown() { public void tearDown() {
removeClient(oidcClientId); removeClient(oidcClientId);
removeClient(oidcBearerOnlyClientId); removeClient(oidcBearerOnlyClientId);
removeClient(oidcBearerOnlyClientWithAuthzId);
removeClient(samlClientId); removeClient(samlClientId);
} }
@ -102,12 +101,19 @@ public class InstallationTest extends AbstractClientTest {
@Test @Test
public void testOidcBearerOnlyWithAuthzJson() { public void testOidcBearerOnlyWithAuthzJson() {
ProfileAssume.assumePreview();
oidcBearerOnlyClientWithAuthzId = createOidcBearerOnlyClientWithAuthz(OIDC_NAME_BEARER_ONLY_WITH_AUTHZ_NAME);
oidcBearerOnlyClientWithAuthz = findClientResource(OIDC_NAME_BEARER_ONLY_WITH_AUTHZ_NAME);
String json = oidcBearerOnlyClientWithAuthz.getInstallationProvider("keycloak-oidc-keycloak-json"); String json = oidcBearerOnlyClientWithAuthz.getInstallationProvider("keycloak-oidc-keycloak-json");
assertOidcInstallationConfig(json); assertOidcInstallationConfig(json);
assertThat(json, containsString("bearer-only")); assertThat(json, containsString("bearer-only"));
assertThat(json, not(containsString("public-client"))); assertThat(json, not(containsString("public-client")));
assertThat(json, containsString("credentials")); assertThat(json, containsString("credentials"));
assertThat(json, containsString("secret")); assertThat(json, containsString("secret"));
removeClient(oidcBearerOnlyClientWithAuthzId);
} }
private void assertOidcInstallationConfig(String config) { private void assertOidcInstallationConfig(String config) {