From 8b83306d5425a1c1e3b498d03e5a2d3c201c38fe Mon Sep 17 00:00:00 2001 From: Zihang Chen Date: Thu, 24 Jul 2014 16:46:50 +0530 Subject: Refactor the Python based test suite This is a squashed commit of the following from parallel-wget: ecd6977 Refactor mainly the test cases classes d26c8eb Create package test for test case classes 507383d Move server classes to package server.protocol 195393b Create package conf where rules and hooks are put 42e482a Create package exc and move TestFailed to exc 82f44f3 Fix a typo in Test-Proto.py 31e5f33 From WgetTest.py move WgetFile to misc 422171d Create package misc, move ColourTerm.py to misc --- testenv/conf/server_files.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 testenv/conf/server_files.py (limited to 'testenv/conf/server_files.py') diff --git a/testenv/conf/server_files.py b/testenv/conf/server_files.py new file mode 100644 index 00000000..bf6c1633 --- /dev/null +++ b/testenv/conf/server_files.py @@ -0,0 +1,15 @@ +from conf import hook + + +@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): + rules = {f.name: test_obj.get_server_rules(f) + for f in files} + files = {f.name: test_obj._replace_substring(f.content) + for f in files} + server.server_conf(files, rules) -- cgit v1.2.1 From f8e9a64ec7445d22f67f1817043d5807c4766556 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Fri, 8 Aug 2014 11:24:08 +0530 Subject: Documentation and code cleanup in test suite Add (lots) of documentation for various parts of the test suite in the form of Python docstrings. Also, clean up some of the redundant code and fix indentation issues. --- testenv/conf/server_files.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'testenv/conf/server_files.py') diff --git a/testenv/conf/server_files.py b/testenv/conf/server_files.py index bf6c1633..1e9d3466 100644 --- a/testenv/conf/server_files.py +++ b/testenv/conf/server_files.py @@ -1,5 +1,16 @@ from conf import hook +""" Pre-Test Hook: ServerFiles +This hook is used to define a set of files on the server's virtual filesystem. +server_files is expected to be dictionary that maps filenames to their +contents. In the future, this can be used to add additional metadat 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: -- cgit v1.2.1