From 7cbe8141d1838fd55f5dedab41f126d256d02e02 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Thu, 24 Jul 2014 16:25:44 +0530 Subject: Introducing Python based Test Environment Squashed Commit, of the following commits: 7743384 Update documentation to reflect changes in code b703633 Add feature that allows to ensure that Wget correctly crawls the website in recursive mode 0758f47 Add new test for recursive spider mode 43bb61b Smartly guess content type header d4d0e63 Support substring replace in File Contents too f578500 Compatibility fix with multiple servers 8b1a9b6 Extend Functionality to support spawning multiple servers e84192a Use the provided calls to shutdown server instead of rewriting it 99659f3 Improve Documentation cb94e52 Slight code cleanup. Remove unused code 886ac1a Shift to new Threading Model from Multiprocessing model e74c2ec Add new test for POST Requests 48644f1 Print diff when file contents don't match b6f9efe Add tests for Cookie support 4c9e6b4 Document pending work e13bc90 Add new test to ensure Content Disposition and Auth work together 60d1f4d Add new Test for Continue command 738b299 Add test, Test-Head 9b9d16b Edit non-unique TEST_NAME variable ae958db Minor optimizations to the way Server Rules are executed 50b4f0c The rules need not be a defaultdict. dccc154 Introducing Python based Test Environment --- testenv/Test-Post.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 testenv/Test-Post.py (limited to 'testenv/Test-Post.py') diff --git a/testenv/Test-Post.py b/testenv/Test-Post.py new file mode 100755 index 00000000..632326fd --- /dev/null +++ b/testenv/Test-Post.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +from sys import exit +from WgetTest import HTTPTest, WgetFile + +""" + Simple test for HTTP POST Requests usiong the --method command +""" +TEST_NAME = "HTTP POST Requests" +############# File Definitions ############################################### +File1 = """A reader lives a thousand lives before he dies, said Jojen. +The man who never reads lives only one""" + +File1_response = """A reader lives a thousand lives before he dies, said Jojen. +The man who never reads lives only one +TestMessage""" + +A_File = WgetFile ("File1", File1) + +WGET_OPTIONS = "-d --method=post --body-data=TestMessage" +WGET_URLS = [["File1"]] + +Files = [[A_File]] + +ExpectedReturnCode = 0 +ExpectedDownloadedFiles = [WgetFile ("File1", File1_response)] + +################ Pre and Post Test Hooks ##################################### +pre_test = { + "ServerFiles" : Files +} +test_options = { + "WgetCommands" : WGET_OPTIONS, + "Urls" : WGET_URLS +} +post_test = { + "ExpectedFiles" : ExpectedDownloadedFiles, + "ExpectedRetcode" : ExpectedReturnCode +} + +err = HTTPTest ( + name=TEST_NAME, + pre_hook=pre_test, + test_params=test_options, + post_hook=post_test +).begin () + +exit (err) -- cgit v1.2.1 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/Test-Post.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'testenv/Test-Post.py') diff --git a/testenv/Test-Post.py b/testenv/Test-Post.py index 632326fd..8983454b 100755 --- a/testenv/Test-Post.py +++ b/testenv/Test-Post.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from sys import exit -from WgetTest import HTTPTest, WgetFile +from test.http_test import HTTPTest +from misc.wget_file import WgetFile """ Simple test for HTTP POST Requests usiong the --method command -- cgit v1.2.1 From 03f8babefe4372acb2580873a637d51bc2086a2b Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Sat, 26 Jul 2014 23:45:57 +0530 Subject: Group common switches in test suite together Some command line switches are passed to Wget unconditionally. These switches should exist in a single place instead of being redundantly defined in each test file. We add the following two switches by default here: 1. --debug: This causes wget to be most verbose and output a lot of debugging information. Hence, if a test fails, the test log should provide valuable information. 2. --no-config: Users may have their own wgetrc files on the system. However, for the tests, we want Wget to run with vanilla settings. Hence, disbale loading any config files. --- testenv/Test-Post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testenv/Test-Post.py') diff --git a/testenv/Test-Post.py b/testenv/Test-Post.py index 8983454b..223641af 100755 --- a/testenv/Test-Post.py +++ b/testenv/Test-Post.py @@ -17,7 +17,7 @@ TestMessage""" A_File = WgetFile ("File1", File1) -WGET_OPTIONS = "-d --method=post --body-data=TestMessage" +WGET_OPTIONS = "--method=post --body-data=TestMessage" WGET_URLS = [["File1"]] Files = [[A_File]] -- cgit v1.2.1