KEYCLOAK-6152 fix WAS adapter tests

This commit is contained in:
vramik 2019-04-05 12:01:08 +02:00 committed by Hynek Mlnařík
parent b39cf1c736
commit 2aeda71e16

View file

@ -971,14 +971,14 @@ public class SAMLServletAdapterTest extends AbstractServletsAdapterTest {
.login().user(user).build() .login().user(user).build()
.processSamlResponse(Binding.POST) .processSamlResponse(Binding.POST)
.transformString(s -> { .transformString(s -> {
Assert.assertThat(s, org.hamcrest.Matchers.containsString(">bburke@redhat.com.additional.domain<")); Assert.assertThat(s, containsString(">bburke@redhat.com.additional.domain<"));
s = s.replaceAll("bburke@redhat.com.additional.domain", "bburke@redhat.com<!-- comment -->.additional.domain"); s = s.replaceAll("bburke@redhat.com.additional.domain", "bburke@redhat.com<!-- comment -->.additional.domain");
return s; return s;
}) })
.build() .build()
.executeAndTransform(resp -> EntityUtils.toString(resp.getEntity())); .executeAndTransform(resp -> EntityUtils.toString(resp.getEntity()));
Assert.assertThat(resultPage, org.hamcrest.Matchers.containsString("principal=bburke@redhat.com.additional.domain")); Assert.assertThat(resultPage, containsString("principal=bburke@redhat.com.additional.domain"));
} }
@Test @Test
@ -992,14 +992,17 @@ public class SAMLServletAdapterTest extends AbstractServletsAdapterTest {
.login().user(user).build() .login().user(user).build()
.processSamlResponse(Binding.POST) .processSamlResponse(Binding.POST)
.transformString(s -> { .transformString(s -> {
Assert.assertThat(s, org.hamcrest.Matchers.containsString(">bburke@redhat.com.additional.domain<")); Assert.assertThat(s, containsString(">bburke@redhat.com.additional.domain<"));
s = s.replaceAll("bburke@redhat.com.additional.domain", "bburke@redhat.com"); s = s.replaceAll("bburke@redhat.com.additional.domain", "bburke@redhat.com");
return s; return s;
}) })
.build() .build()
.executeAndTransform(resp -> EntityUtils.toString(resp.getEntity())); .executeAndTransform(resp -> EntityUtils.toString(resp.getEntity()));
Assert.assertThat(resultPage, org.hamcrest.Matchers.containsString("INVALID_SIGNATURE")); Assert.assertThat(resultPage, anyOf(
containsString("INVALID_SIGNATURE"),
containsString("Error 403: SRVE0295E: Error reported: 403") //WAS
));
} }
@Test @Test