Debian Codegraph @

testenv/Test-auth-retcode.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 returns the correct return code when sent
8 a 403 Forbidden by the Server.
9 """
10
11
12 ############# File Definitions ###############################################
13 File1 = "Apples and Oranges? Really?"
14
15 File1_rules = {
16 "Response" : 403
17 }
18
19 A_File = WgetFile ("File1", File1, rules=File1_rules)
20
21 WGET_OPTIONS = ""
22 WGET_URLS = [["File1"]]
23
24 Files = [[A_File]]
25
26 ExpectedReturnCode = 8
27 ExpectedDownloadedFiles = []
28
29 ################ Pre and Post Test Hooks #####################################
30 pre_test = {
31 "ServerFiles" : Files
32 }
33 test_options = {
34 "WgetCommands" : WGET_OPTIONS,
35 "Urls" : WGET_URLS
36 }
37 post_test = {
38 "ExpectedFiles" : ExpectedDownloadedFiles,
39 "ExpectedRetcode" : ExpectedReturnCode
40 }
41
42 err = HTTPTest (
43 pre_hook=pre_test,
44 test_params=test_options,
45 post_hook=post_test
46 ).begin ()
47
48 exit (err)