From 078245d94f4acf862d0bf8a1b053bc875500e1f6 Mon Sep 17 00:00:00 2001 From: Will Pimblett Date: Sat, 28 Jan 2023 19:42:33 +0000 Subject: [PATCH] Add addtional check for 404 images Testing out re issue #207 --- htmltest/check-img_test.go | 11 ++++++++++- htmltest/fixtures/images/imageExternal404.html | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 htmltest/fixtures/images/imageExternal404.html diff --git a/htmltest/check-img_test.go b/htmltest/check-img_test.go index e0bee46..a8d34cc 100644 --- a/htmltest/check-img_test.go +++ b/htmltest/check-img_test.go @@ -18,7 +18,16 @@ func TestImageExternalMissing(t *testing.T) { map[string]interface{}{"VCREnable": true}) tExpectIssueCount(t, hT, 1) // Issue contains "no such host" - // tExpectIssue(t, hT, "no such host", 1) + tExpectIssue(t, hT, "no such host", 1) +} + +func TestImageExternal404(t *testing.T) { + // fails for missing external images + hT := tTestFileOpts("fixtures/images/imageExternal404.html", + map[string]interface{}{"VCREnable": true}) + tExpectIssueCount(t, hT, 1) + // Issue contains "no such host" + tExpectIssue(t, hT, "Non-OK status: 404", 1) } func TestImageExternalMissingProtocolValid(t *testing.T) { diff --git a/htmltest/fixtures/images/imageExternal404.html b/htmltest/fixtures/images/imageExternal404.html new file mode 100644 index 0000000..86573be --- /dev/null +++ b/htmltest/fixtures/images/imageExternal404.html @@ -0,0 +1,9 @@ + + + + +

Blah blah blah. A src that'll return 404

+ + + +