Debian Codegraph @

testenv/Test-auth-no-challenge.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 Wget's Basic Authorization Negotiation, when the
8 --auth-no-challenge command is used.
9 """
10 ############# File Definitions ###############################################
11 File1 = "Need a cookie?"
12
13 File1_rules = {
14 "Authentication" : {
15 "Type" : "Basic",
16 "User" : "Pacman",
17 "Pass" : "Omnomnom"
18 },
19 "ExpectHeader" : {
20 "Authorization" : "Basic UGFjbWFuOk9tbm9tbm9t"
21 }
22 }
23 A_File = WgetFile ("File1", File1, rules=File1_rules)
24
25 WGET_OPTIONS = "--auth-no-challenge --user=Pacman --password=Omnomnom"
26 WGET_URLS = [["File1"]]
27
28 Files = [[A_File]]
29
30 ExpectedReturnCode = 0
31 ExpectedDownloadedFiles = [A_File]
32
33 ################ Pre and Post Test Hooks #####################################
34 pre_test = {
35 "ServerFiles" : Files
36 }
37 test_options = {
38 "WgetCommands" : WGET_OPTIONS,
39 "Urls" : WGET_URLS
40 }
41 post_test = {
42 "ExpectedFiles" : ExpectedDownloadedFiles,
43 "ExpectedRetcode" : ExpectedReturnCode
44 }
45
46 err = HTTPTest (
47 pre_hook=pre_test,
48 test_params=test_options,
49 post_hook=post_test
50 ).begin ()
51
52 exit (err)