Debian Codegraph @

testenv/Test-auth-basic-fail.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 exit code when Basic
8 authentication fails due to a username/password error.
9 """
10 ############# File Definitions ###############################################
11 File1 = "I am an invisible man."
12
13 File1_rules = {
14 "Authentication" : {
15 "Type" : "Basic",
16 "User" : "Sauron",
17 "Pass" : "TheEye"
18 }
19 }
20 A_File = WgetFile ("File1", File1, rules=File1_rules)
21
22 WGET_OPTIONS = "--user=Sauron --password=Eye"
23 WGET_URLS = [["File1"]]
24
25 Files = [[A_File]]
26
27 ExpectedReturnCode = 6
28 ExpectedDownloadedFiles = []
29
30 ################ Pre and Post Test Hooks #####################################
31 pre_test = {
32 "ServerFiles" : Files
33 }
34 test_options = {
35 "WgetCommands" : WGET_OPTIONS,
36 "Urls" : WGET_URLS
37 }
38 post_test = {
39 "ExpectedFiles" : ExpectedDownloadedFiles,
40 "ExpectedRetcode" : ExpectedReturnCode
41 }
42
43 err = HTTPTest (
44 pre_hook=pre_test,
45 test_params=test_options,
46 post_hook=post_test
47 ).begin ()
48
49 exit (err)