From 867bb203393c37df2c2365b18a4cbf9bc6b42db9 Mon Sep 17 00:00:00 2001 From: mhajas Date: Wed, 13 Sep 2017 09:57:16 +0200 Subject: [PATCH] KEYCLOAK-5286 Add test for failing scenario --- .../clients/ClientMappersOIDCTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java index eaa45dedad..2330527bc6 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java @@ -35,6 +35,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.*; import static org.keycloak.testsuite.auth.page.login.Login.OIDC; import static org.keycloak.testsuite.console.clients.AbstractClientTest.createClientRep; @@ -375,4 +377,23 @@ public class ClientMappersOIDCTest extends AbstractClientTest { createClientMappersPage.form().save(); assertAlertDanger(); } + + @Test + public void testUpdateTokenClaimName() { + clientMappersPage.mapperTable().createMapper(); + + createClientMappersPage.form().setName("test"); + createClientMappersPage.form().setTokenClaimName("test"); + createClientMappersPage.form().save(); + assertAlertSuccess(); + + createClientMappersPage.form().setTokenClaimName("test2"); + createClientMappersPage.form().save(); + assertAlertSuccess(); + + ProtocolMapperRepresentation mapper = testRealmResource().clients().get(id).getProtocolMappers().getMappers() + .stream().filter(m -> m.getName().equals("test")).findFirst().get(); + + assertThat(mapper.getConfig().get("claim.name"), is(equalTo("test2"))); + } } \ No newline at end of file