KEYCLOAK-5286 Add test for failing scenario

This commit is contained in:
mhajas 2017-09-13 09:57:16 +02:00
parent 0a5de1239f
commit 867bb20339

View file

@ -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")));
}
}