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 <[email protected]> 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) -- 1.9.1
