Debian Codegraph @

testenv/Test-O.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 the -O command for output
8 filenames.
9 """
10 ############# File Definitions ###############################################
11 File1 = "Test Contents."
12
13 A_File = WgetFile ("File1", File1)
14
15 WGET_OPTIONS = "-O NewFile.txt"
16 WGET_URLS = [["File1"]]
17
18 Files = [[A_File]]
19 ExistingFiles = [A_File]
20
21 ExpectedReturnCode = 0
22 ExpectedDownloadedFiles = [WgetFile ("NewFile.txt", File1)]
23
24 ################ Pre and Post Test Hooks #####################################
25 pre_test = {
26 "ServerFiles" : Files
27 }
28 test_options = {
29 "WgetCommands" : WGET_OPTIONS,
30 "Urls" : WGET_URLS
31 }
32 post_test = {
33 "ExpectedFiles" : ExpectedDownloadedFiles,
34 "ExpectedRetcode" : ExpectedReturnCode
35 }
36
37 err = HTTPTest (
38 pre_hook=pre_test,
39 test_params=test_options,
40 post_hook=post_test
41 ).begin ()
42
43 exit (err)