Debian Codegraph @

testenv/Test-Head.py

raw
1 #!/usr/bin/env python3
2 from sys import exit
3 from test.http_test import HTTPTest
4 from misc.wget_file import WgetFile
5
6 """
7 This test ensures that Wget correctly handles responses to HEAD requests
8 and does not actually download any data
9 """
10 ############# File Definitions ###############################################
11 File1 = "You shall not pass!"
12
13 A_File = WgetFile ("File1", File1)
14
15 WGET_OPTIONS = "--method=HEAD"
16 WGET_URLS = [["File1"]]
17
18 Files = [[A_File]]
19
20 ExpectedReturnCode = 0
21 ExpectedDownloadedFiles = []
22
23 ################ Pre and Post Test Hooks #####################################
24 pre_test = {
25 "ServerFiles" : Files,
26 }
27 test_options = {
28 "WgetCommands" : WGET_OPTIONS,
29 "Urls" : WGET_URLS
30 }
31 post_test = {
32 "ExpectedFiles" : ExpectedDownloadedFiles,
33 "ExpectedRetcode" : ExpectedReturnCode
34 }
35
36 err = HTTPTest (
37 pre_hook=pre_test,
38 test_params=test_options,
39 post_hook=post_test
40 ).begin ()
41
42 exit (err)