bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [PATCH] Added wget http test for 503 Service unavailable


From: Tim Rühsen
Subject: Re: [Bug-wget] [PATCH] Added wget http test for 503 Service unavailable
Date: Sat, 14 Mar 2015 12:05:33 +0100
User-agent: KMail/4.14.2 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; )

Hi Satyam,

good work, thanks for your coitribution !

Just two little things are missing for a complete patch:
- please add the test to testenv/Makefile.am (so it is executed with 'make 
check')
- please chmod a+x testenv/Test-503.py (so one can execute the test stand-
alone if needed)


And a general question to everybody about temporary failures and Wget. 
Shouldn't wget try again after a pause in case of temp failures ? 503 is such 
a temp failure.
I guess that would be in the 'spirit' of Wget !?
[Satyam, that does not effect your patch right now]

Tim

Am Samstag, 14. März 2015, 03:18:07 schrieb Satyam Zode:
> Hello everyone !
> I am working wget FTP test suite . I have written a Test for 503
> Service unavailable feature of wget (For HTTP server).
> Please verify it and correct me if I am making any mistake.
> All suggestions are welcome :-) . I am also working on other tests too .
> 
> 
> Here is Test-503 patch .
> 
> From ce32f9ee17fcd9544a34cf9e3656ee7e10ea289d Mon Sep 17 00:00:00 2001
> From: Satyam Zode <address@hidden>
> Date: Sat, 14 Mar 2015 02:46:26 +0530
> Subject: [PATCH] Added wget http  test for 503 Service unavailable
> 
> ---
>  testenv/Test-503.py | 60
> +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60
> insertions(+)
>  create mode 100644 testenv/Test-503.py
> 
> diff --git a/testenv/Test-503.py b/testenv/Test-503.py
> new file mode 100644
> index 0000000..7f1c3c8
> --- /dev/null
> +++ b/testenv/Test-503.py
> @@ -0,0 +1,60 @@
> +#!/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 = """All happy
> families are alike;
> +Each unhappy family is unhappy in its own way"""
> +File2 = "Anyone for chocochip cookies?"
> +
> +File1_rules = {
> +    "Response"          : 503
> +}
> +
> +A_File = WgetFile ("File1", File1, rules=File1_rules)
> +B_File = WgetFile ("File2", File2)
> +
> +Request_List = [
> +    [
> +        "GET /File1",
> +        "GET /File2",
> +    ]
> +]
> +
> +
> +WGET_OPTIONS = "--tries=2"
> +WGET_URLS = [["File1", "File2"]]
> +
> +Files = [[A_File, B_File]]
> +
> +ExpectedReturnCode = 8
> +ExpectedDownloadedFiles = [B_File]
> +
> +################ 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)

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]