You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2023/02/24 12:08:33 UTC
[syncope] 02/02: Even more flexible assertions for SRA IT cases
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 1ece2b2c55db31e84098065ded1e2a8f7b31e97e
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Feb 24 13:08:22 2023 +0100
Even more flexible assertions for SRA IT cases
---
.../src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java | 6 +++---
.../src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java | 4 ++++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java
index 0b7beafbff..d0bb96a093 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java
@@ -263,9 +263,9 @@ public abstract class AbstractSRAITCase extends AbstractITCase {
assertEquals(MediaType.TEXT_HTML, headers.get(HttpHeaders.ACCEPT).asText());
assertThat(headers.get("X-Forwarded-Host").asText(), is(oneOf("localhost:" + PORT, "127.0.0.1:" + PORT)));
- assertEquals(
- StringUtils.substringBefore(originalRequestURI, "?"),
- StringUtils.substringBefore(json.get("url").asText(), "?"));
+ String withHost = StringUtils.substringBefore(originalRequestURI, "?");
+ String withIP = withHost.replace("localhost", "127.0.0.1");
+ assertThat(StringUtils.substringBefore(json.get("url").asText(), "?"), is(oneOf(withHost, withIP)));
return headers;
}
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
index fb27f5ef09..580b78ebd1 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
@@ -277,6 +277,10 @@ public class OIDCSRAITCase extends AbstractSRAITCase {
assertEquals(MediaType.APPLICATION_JSON, headers.get(HttpHeaders.CONTENT_TYPE).asText());
assertThat(headers.get("X-Forwarded-Host").asText(), is(oneOf("localhost:" + PORT, "127.0.0.1:" + PORT)));
+ String withHost = client.getBaseURI().toASCIIString().replace("/protected", "");
+ String withIP = withHost.replace("localhost", "127.0.0.1");
+ assertThat(json.get("url").asText(), is(oneOf(withHost, withIP)));
+
assertEquals(client.getBaseURI().toASCIIString().replace("/protected", ""), json.get("url").asText());
}
}