Add test, Test-Head

This commit is contained in:
Darshit Shah 2013-09-02 11:11:34 +05:30
parent 9b9d16b2f3
commit 738b299419
3 changed files with 50 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2013-09-02 Darshit Shah <darnir@gmail.com>
* Makefile.am: Add new Test
* Test-Head.py: New Test to ensure HEAD requests are handled correctly
2013-08-31 Darshit Shah <darnir@gmail.com>
* README: Explain that TEST_NAME needs to be unique

View File

@ -36,7 +36,8 @@ TESTS = Test-auth-basic-fail.py \
Test-auth-no-challenge-url.py \
Test-auth-retcode.py \
Test-Content-disposition-2.py \
Test-Content-disposition.py
Test-Content-disposition.py \
Test-Head.py
XFAIL_TESTS = Test-auth-both.py
LOG_COMPILER = python3

43
testenv/Test-Head.py Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env python3
from sys import exit
from WgetTest import HTTPTest, WgetFile
"""
This test ensures that Wget correctly handles responses to HEAD requests
and does not actually download any data
"""
TEST_NAME = "HEAD Requests"
############# File Definitions ###############################################
File1 = "You shall not pass!"
A_File = WgetFile ("File1", File1)
WGET_OPTIONS = "-d --method=HEAD"
WGET_URLS = ["File1"]
Files = [A_File]
ExpectedReturnCode = 0
ExpectedDownloadedFiles = []
################ 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)