mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
test(sanitizer): add unit test for 0x0 pixel tracker
This commit is contained in:
parent
152ef578d2
commit
a313c8a66d
1 changed files with 11 additions and 1 deletions
|
@ -709,7 +709,7 @@ func TestImageSrcWithTrackers(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPixelTracker(t *testing.T) {
|
func Test1x1PixelTracker(t *testing.T) {
|
||||||
input := `<p><img src="https://tracker1.example.org/" height="1" width="1"> and <img src="https://tracker2.example.org/" height="1" width="1"/></p>`
|
input := `<p><img src="https://tracker1.example.org/" height="1" width="1"> and <img src="https://tracker2.example.org/" height="1" width="1"/></p>`
|
||||||
expected := `<p> and </p>`
|
expected := `<p> and </p>`
|
||||||
output := SanitizeHTMLWithDefaultOptions("http://example.org/", input)
|
output := SanitizeHTMLWithDefaultOptions("http://example.org/", input)
|
||||||
|
@ -719,6 +719,16 @@ func TestPixelTracker(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test0x0PixelTracker(t *testing.T) {
|
||||||
|
input := `<p><img src="https://tracker1.example.org/" height="0" width="0"> and <img src="https://tracker2.example.org/" height="0" width="0"/></p>`
|
||||||
|
expected := `<p> and </p>`
|
||||||
|
output := SanitizeHTMLWithDefaultOptions("http://example.org/", input)
|
||||||
|
|
||||||
|
if expected != output {
|
||||||
|
t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestXmlEntities(t *testing.T) {
|
func TestXmlEntities(t *testing.T) {
|
||||||
input := `<pre>echo "test" > /etc/hosts</pre>`
|
input := `<pre>echo "test" > /etc/hosts</pre>`
|
||||||
expected := `<pre>echo "test" > /etc/hosts</pre>`
|
expected := `<pre>echo "test" > /etc/hosts</pre>`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue