summaryrefslogtreecommitdiffstats
path: root/testenv/conf/server_files.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:25:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:25:44 +0000
commitb3925d944ed94cc76bbcbb14a799ec9beeb8d1bf (patch)
treea5e5ccdbc84294390695b5ae3a8c89cc16e6cbae /testenv/conf/server_files.py
parentInitial commit. (diff)
downloadwget-b3925d944ed94cc76bbcbb14a799ec9beeb8d1bf.tar.xz
wget-b3925d944ed94cc76bbcbb14a799ec9beeb8d1bf.zip
Adding upstream version 1.21.4.upstream/1.21.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testenv/conf/server_files.py')
-rw-r--r--testenv/conf/server_files.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/testenv/conf/server_files.py b/testenv/conf/server_files.py
new file mode 100644
index 0000000..6ab4962
--- /dev/null
+++ b/testenv/conf/server_files.py
@@ -0,0 +1,26 @@
+from conf import hook
+
+""" Pre-Test Hook: ServerFiles
+This hook is used to define a set of files on the server's virtual file system.
+server_files is expected to be dictionary that maps filenames to their
+contents. In the future, this can be used to add additional metadata to the
+files using the WgetFile class too.
+
+This hook also does some additional processing on the contents of the file. Any
+text between {{and}} is replaced by the contents of a class variable of the
+same name. This is useful in creating files that contain an absolute link to
+another file on the same server. """
+
+
+@hook()
+class ServerFiles:
+ def __init__(self, server_files):
+ self.server_files = server_files
+
+ def __call__(self, test_obj):
+ for server, files in zip(test_obj.servers, self.server_files):
+ files_content = {f.name: test_obj._replace_substring(f.content)
+ for f in files}
+ files_rules = {f.name: test_obj.get_server_rules(f)
+ for f in files}
+ server.server_conf(files_content, files_rules)