From e699ee37459135528168e9d4056342c76d267ae4 Mon Sep 17 00:00:00 2001 From: rehan Date: Sat, 2 Nov 2024 20:30:11 +0530 Subject: [PATCH] test: Remove test ignores by wire mocking --- .../check/BrokenHttpLinksCheckerSpec.groovy | 7 +++---- .../test/dns/CustomHostNameResolver.java | 3 ++- .../src/test/resources/mappings.json | 14 +++++++++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenHttpLinksCheckerSpec.groovy b/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenHttpLinksCheckerSpec.groovy index 684e5748..dd8be8b9 100644 --- a/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenHttpLinksCheckerSpec.groovy +++ b/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenHttpLinksCheckerSpec.groovy @@ -185,11 +185,10 @@ class BrokenHttpLinksCheckerSpec extends Specification { } - @Ignore // If({ !System.getenv('GITHUB_ACTIONS') }) def "bad amazon link is identified as problem"() { given: "an HTML page with a single (good) amazon link" - String badAmazonLink = "https://www.amazon.com/dp/4242424242" + String badAmazonLink = "https://www.amazon.com:$port/dp/4242424242" String HTML = """$HtmlConst.HTML_HEAD Amazon $HtmlConst.HTML_END """ @@ -228,12 +227,12 @@ class BrokenHttpLinksCheckerSpec extends Specification { } - @Ignore + def 'redirects are recognized and their new location is contained in warning message'() { given: "the old arc42 (http!) page " String HTML = """$HtmlConst.HTML_HEAD - + $HtmlConst.HTML_END """ htmlPage = new HtmlPage(HTML) diff --git a/htmlSanityCheck-core/src/test/java/org/aim42/htmlsanitycheck/test/dns/CustomHostNameResolver.java b/htmlSanityCheck-core/src/test/java/org/aim42/htmlsanitycheck/test/dns/CustomHostNameResolver.java index 84261a3e..c5e7d98f 100644 --- a/htmlSanityCheck-core/src/test/java/org/aim42/htmlsanitycheck/test/dns/CustomHostNameResolver.java +++ b/htmlSanityCheck-core/src/test/java/org/aim42/htmlsanitycheck/test/dns/CustomHostNameResolver.java @@ -18,7 +18,8 @@ public class CustomHostNameResolver { "plumelib.org", "people.csail.mit.edu", "arc42.org", - "mock.codes" + "mock.codes", + "arc42.de" ); static { diff --git a/htmlSanityCheck-core/src/test/resources/mappings.json b/htmlSanityCheck-core/src/test/resources/mappings.json index eea68ad7..d765c42e 100644 --- a/htmlSanityCheck-core/src/test/resources/mappings.json +++ b/htmlSanityCheck-core/src/test/resources/mappings.json @@ -97,7 +97,7 @@ { "request": { "method": "GET_OR_HEAD", - "urlPattern": "/403" + "urlPattern": "/(403 | dp/4242424242)" }, "response": { "status": 403, @@ -285,6 +285,18 @@ "Content-Type": "text/plain" } } + }, + { + "request": { + "method": "GET_OR_HEAD", + "urlPattern": "/old" + }, + "response": { + "status": 302, + "headers": { + "Location": "https://arc42.de" + } + } } ] } \ No newline at end of file