summaryrefslogtreecommitdiffstats
path: root/testenv/test_css_url.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:55:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:55:47 +0000
commitcd10ccf4d1b4671883a0d45f6769947a6cdb45d0 (patch)
treeb14481899a2c6c4dd53beed82f0f61c6f77254d1 /testenv/test_css_url.py
parentAdding upstream version 1.21.4. (diff)
downloadwget-cd10ccf4d1b4671883a0d45f6769947a6cdb45d0.tar.xz
wget-cd10ccf4d1b4671883a0d45f6769947a6cdb45d0.zip
Adding upstream version 1.24.5.upstream/1.24.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testenv/test_css_url.py')
-rwxr-xr-xtestenv/test_css_url.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/testenv/test_css_url.py b/testenv/test_css_url.py
new file mode 100755
index 0000000..1c1c8f8
--- /dev/null
+++ b/testenv/test_css_url.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+
+"""Ensure that Wget correctly encodes url() parameters in CSS."""
+
+from test.base_test import HTTP
+from test.http_test import HTTPTest
+
+from misc.wget_file import WgetFile
+
+############################## File Definitions ###############################
+FILE1 = """<html>
+ <head>
+<style>
+body {
+ background-image: url(image%201.html);
+}
+</style>
+ </head>
+ <body>Hello</body>
+</html>"""
+
+
+FILE2 = "This is an image"
+
+File1_File = WgetFile("index.html", FILE1)
+File2_File = WgetFile("image 1.html", FILE2)
+File2_ServerFile = WgetFile("image%201.html", FILE2)
+
+WGET_OPTIONS = "--recursive --convert-links --no-host-directories"
+WGET_URLS = [[""]]
+
+Servers = [HTTP]
+
+Files = [[File1_File, File2_ServerFile]]
+Existing_Files = []
+
+ExpectedReturnCode = 0
+ExpectedDownloadedFiles = [File1_File, File2_File]
+# Request_List = [["GET /",
+# "GET /image 1.html"]]
+
+################ Pre and Post Test Hooks #####################################
+pre_test = {
+ "ServerFiles" : Files,
+ "LocalFiles" : Existing_Files
+}
+test_options = {
+ "WgetCommands" : WGET_OPTIONS,
+ "Urls" : WGET_URLS
+}
+post_test = {
+ "ExpectedFiles" : ExpectedDownloadedFiles,
+ "ExpectedRetcode" : ExpectedReturnCode
+}
+
+err = HTTPTest (
+ pre_hook=pre_test,
+ test_params=test_options,
+ post_hook=post_test,
+ protocols=Servers
+).begin ()
+
+exit (err)