From 507383df07e591180614a1e43854314162bbcac5 Mon Sep 17 00:00:00 2001 From: Zihang Chen Date: Thu, 13 Mar 2014 18:51:54 +0800 Subject: [PATCH] Move server classes to package server.protocol delete mode 100644 testenv/FTPServer.py delete mode 100644 testenv/HTTPServer.py create mode 100644 testenv/server/__init__.py create mode 100644 testenv/server/ftp/__init__.py create mode 100644 testenv/server/ftp/ftp_server.py create mode 100644 testenv/server/http/__init__.py create mode 100644 testenv/server/http/http_server.py --- testenv/ChangeLog | 10 ++++++++++ testenv/README | 6 +++--- testenv/WgetTest.py | 7 +++---- testenv/server/__init__.py | 1 + testenv/server/ftp/__init__.py | 1 + testenv/{FTPServer.py => server/ftp/ftp_server.py} | 0 testenv/server/http/__init__.py | 1 + testenv/{HTTPServer.py => server/http/http_server.py} | 0 8 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 testenv/server/__init__.py create mode 100644 testenv/server/ftp/__init__.py rename testenv/{FTPServer.py => server/ftp/ftp_server.py} (100%) create mode 100644 testenv/server/http/__init__.py rename testenv/{HTTPServer.py => server/http/http_server.py} (100%) diff --git a/testenv/ChangeLog b/testenv/ChangeLog index 1f6fbec4..928d9310 100644 --- a/testenv/ChangeLog +++ b/testenv/ChangeLog @@ -1,3 +1,13 @@ +2014-03-13 Zihang Chen + + * server: (new package) package for the server classes + * server.http: (new package) package for HTTP server + * server.ftp: (new package) package for FTP server + * HTTPServer.py: Move to server/http/http_server.py. Also change the + CERTFILE to '../certs/wget-cert.pem'. + * FTPServer.py: Move to server/ftp/ftp_server.py. + * WgetTest.py: Optimize import respect to the server classes. + 2014-03-13 Zihang Chen * conf: (new package) package for rule classes and hook methods diff --git a/testenv/README b/testenv/README index e859494d..7863c3d3 100644 --- a/testenv/README +++ b/testenv/README @@ -13,9 +13,9 @@ n tests simultaneously. Structure: ================================================================================ - * HTTPServer.py: This file contains a custom, programmatically configurable - HTTP Server for testing Wget. It runs an instance of Python's http.server - module. + * server: This package contains custom programmatically configurable servers + (both HTTP and FTP) for testing Wget. The HTTP server runs an instance of + Python's http.server module. The FTP server is to be implemented. * WgetTest.py: This file contains various functions and global variables for each instance of the server that is initiated. It includes functions to diff --git a/testenv/WgetTest.py b/testenv/WgetTest.py index 3915286b..01ef4794 100644 --- a/testenv/WgetTest.py +++ b/testenv/WgetTest.py @@ -3,7 +3,6 @@ import shutil import shlex import sys import traceback -import HTTPServer import re import time from subprocess import call @@ -11,12 +10,12 @@ from misc.colour_terminal import print_red, print_green, print_blue from difflib import unified_diff from exc.test_failed import TestFailed import conf +from server.http import http_server HTTP = "HTTP" HTTPS = "HTTPS" - """ Class that defines methods common to both HTTP and FTP Tests. """ class CommonMethods: @@ -218,12 +217,12 @@ class HTTPTest (CommonMethods): self.hook_call(post_hook, 'Post Test Function') def init_HTTP_Server (self): - server = HTTPServer.HTTPd () + server = http_server.HTTPd () server.start () return server def init_HTTPS_Server (self): - server = HTTPServer.HTTPSd () + server = http_server.HTTPSd () server.start () return server diff --git a/testenv/server/__init__.py b/testenv/server/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/testenv/server/__init__.py @@ -0,0 +1 @@ + diff --git a/testenv/server/ftp/__init__.py b/testenv/server/ftp/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/testenv/server/ftp/__init__.py @@ -0,0 +1 @@ + diff --git a/testenv/FTPServer.py b/testenv/server/ftp/ftp_server.py similarity index 100% rename from testenv/FTPServer.py rename to testenv/server/ftp/ftp_server.py diff --git a/testenv/server/http/__init__.py b/testenv/server/http/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/testenv/server/http/__init__.py @@ -0,0 +1 @@ + diff --git a/testenv/HTTPServer.py b/testenv/server/http/http_server.py similarity index 100% rename from testenv/HTTPServer.py rename to testenv/server/http/http_server.py