1#!/usr/bin/env python3
2from sys import exit
3from test.http_test import HTTPTest
4from 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 ###############################################
11File1 = "You shall not pass!"
12
13A_File = WgetFile ("File1", File1)
14
15WGET_OPTIONS = "--method=HEAD"
16WGET_URLS = [["File1"]]
17
18Files = [[A_File]]
19
20ExpectedReturnCode = 0
21ExpectedDownloadedFiles = []
22
23################ Pre and Post Test Hooks #####################################
24pre_test = {
25    "ServerFiles"       : Files,
26}
27test_options = {
28    "WgetCommands"      : WGET_OPTIONS,
29    "Urls"              : WGET_URLS
30}
31post_test = {
32    "ExpectedFiles"     : ExpectedDownloadedFiles,
33    "ExpectedRetcode"   : ExpectedReturnCode
34}
35
36err = HTTPTest (
37                pre_hook=pre_test,
38                test_params=test_options,
39                post_hook=post_test
40).begin ()
41
42exit (err)
43