Hello everyone !
Apologies for the delay in response. First of all thanks Darshit for
putting errors in limelight. Please find attached latest and updated
version of the patch.
Before sending patch here I tested it on another copy of source and it
worked well for me.

Thank you!
Satyam Zode
PICT , Pune


On Wed, Apr 15, 2015 at 2:23 PM, Darshit Shah <[email protected]> wrote:
> Hi Satyam,
>
> If I remember correctly, this was the latest version of your patch. I have a
> few comments about it, after which we can begin merging it into the code
> base.
>
>> From 55b0bb821496f324f133283c8c7ba35c3a64ee63 Mon Sep 17 00:00:00 2001
>> From: Satyam Zode <[email protected]>
>> Date: Sun, 15 Mar 2015 02:35:06 +0530
>> Subject: [PATCH] Added wget http test for 503 Service unavailable
>>
> Could you *please* write a commit message in the GNU ChangeLog style? Take a
> look at the other commit messages in the repository for ideas.
>
>> ---
>> testenv/Makefile.am |  1 +
>> testenv/Test-503.py | 59
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 60 insertions(+)
>> mode change 100644 => 100755 testenv/Makefile.am
>> create mode 100755 testenv/Test-503.py
>>
>> diff --git a/testenv/Makefile.am b/testenv/Makefile.am
>> old mode 100644
>> new mode 100755
>> index a4e0352..5360eb6
>> --- a/testenv/Makefile.am
>> +++ b/testenv/Makefile.am
>> @@ -52,6 +52,7 @@ if HAVE_PYTHON3
>>     Test-O.py                                       \
>>     Test-Post.py                                    \
>>     Test-504.py                                     \
>> +    Test-503.py                                     \
>>     Test--spider-r.py                               \
>>     Test-redirect-crash.py
>>
>> diff --git a/testenv/Test-503.py b/testenv/Test-503.py
>> new file mode 100755
>> index 0000000..21049ec
>> --- /dev/null
>> +++ b/testenv/Test-503.py
>> @@ -0,0 +1,59 @@
>> +#!/usr/bin/env python3
>> +from sys import exit
>> +from test.http_test import HTTPTest
>> +from misc.wget_file import WgetFile
>> +
>> +"""
>> +    This test ensures that Wget handles a 503 Service Unavailable
>> response
>> +    correctly.
>> +"""
>> +TEST_NAME = "503 Service Unavailable"
>> +############# File Definitions
>> ###############################################
>> +File1 = """ You have to learn the rules of the game. And then you
>> have to play better than anyone else. - Albert Einstein"""
>
> Please wrap this line to 80 characters.
>>
>> +
>> +
>> +File1_rules = {
>> +
>
> Un-necessary new line
>>
>> +    "Response"          : 503
>> +}
>> +
>> +A_File = WgetFile ("File1", File1, rules=File1_rules)
>> +
>> +Request_List = [
>> +    [
>> +        "GET /File1"
>> +
>
> Same
>
>> +    ]
>> +]
>> +
>> +
>> +WGET_OPTIONS = " "
>> +WGET_URLS = [["File1"]]
>> +
>> +Files = [[A_File]]
>> +
>> +ExpectedReturnCode = 8
>> +ExpectedDownloadedFiles = []
>> +
>> +################ Pre and Post Test Hooks
>> #####################################
>> +pre_test = {
>> +    "ServerFiles"       : Files
>> +}
>> +test_options = {
>> +    "WgetCommands"      : WGET_OPTIONS,
>> +    "Urls"              : WGET_URLS
>> +}
>> +post_test = {
>> +    "ExpectedFiles"     : ExpectedDownloadedFiles,
>> +    "ExpectedRetcode"   : ExpectedReturnCode,
>> +    "FilesCrawled"      : Request_List
>> +}
>> +
>> +err = HTTPTest (
>> +                name=TEST_NAME,
>> +                pre_hook=pre_test,
>> +                test_params=test_options,
>> +                post_hook=post_test
>> +).begin ()
>> +
>> +exit (err)
>> --
>> 1.9.1
>>
>
> Also, when I apply your patch Git complains about whitespace errors in two
> places. Please take a look at those too
>
>
> --
> Thanking You,
> Darshit Shah
From 8e8223ad0a77940b89f1c2ab1978afbb6775c2ee Mon Sep 17 00:00:00 2001
From: Satyam Zode <[email protected]>
Date: Sat, 18 Apr 2015 19:09:31 +0530
Subject: [PATCH] tests: Add new test case for 503 Service unavailable

	* testenv/Test-503.py: Add new test 503 Service unavailable
	* testenv/Makefile.am: Add Test-503.py to TESTS
---
 testenv/Makefile.am |  3 ++-
 testenv/Test-503.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 testenv/Test-503.py

diff --git a/testenv/Makefile.am b/testenv/Makefile.am
index a4e0352..a6d4907 100644
--- a/testenv/Makefile.am
+++ b/testenv/Makefile.am
@@ -53,7 +53,8 @@ if HAVE_PYTHON3
     Test-Post.py                                    \
     Test-504.py                                     \
     Test--spider-r.py                               \
-    Test-redirect-crash.py
+    Test-redirect-crash.py                          \
+    Test-503.py
 
   # added test cases expected to fail here and under TESTS
   XFAIL_TESTS =
diff --git a/testenv/Test-503.py b/testenv/Test-503.py
new file mode 100644
index 0000000..0ada0fc
--- /dev/null
+++ b/testenv/Test-503.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+from sys import exit
+from test.http_test import HTTPTest
+from misc.wget_file import WgetFile
+
+"""
+This test ensures that Wget handles a 503 Service Unavailable response correctly.
+"""
+TEST_NAME = "503 Service Unavailable"
+############# File Definitions #############
+File1 = """You shall work"""
+
+File1_rules = {
+    "Response"          : 503
+}
+
+A_File = WgetFile ("File1", File1, rules=File1_rules)
+
+Request_List = [
+    [
+        "GET /File1"
+    ]
+]
+
+WGET_OPTIONS = " "
+WGET_URLS = [["File1"]]
+
+Files = [[A_File]]
+
+ExpectedReturnCode = 8
+ExpectedDownloadedFiles = []
+
+################ Pre and Post Test Hooks #####################################
+pre_test = {
+    "ServerFiles"       : Files
+}
+test_options = {
+    "WgetCommands"      : WGET_OPTIONS,
+    "Urls"              : WGET_URLS
+}
+post_test = {
+    "ExpectedFiles"     : ExpectedDownloadedFiles,
+    "ExpectedRetcode"   : ExpectedReturnCode,
+    "FilesCrawled"      : Request_List
+}
+
+err = HTTPTest (
+                name=TEST_NAME,
+                pre_hook=pre_test,
+                test_params=test_options,
+                post_hook=post_test
+).begin ()
+
+exit (err)
-- 
1.9.1

Reply via email to