Debian Codegraph @

testenv/Test-auth-digest.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 Digest Authorization Negotiation.
8 """
9 ############# File Definitions ###############################################
10 File1 = "Need a cookie?"
11 File2 = "Want cookies with milk!"
12
13 File1_rules = {
14 "Authentication" : {
15 "Type" : "Digest",
16 "User" : "Pacman",
17 "Pass" : "Omnomnom",
18 "Parm" : {
19 "qop" : "auth"
20 }
21 }
22 }
23
24 File2_rules = {
25 "Authentication" : {
26 "Type" : "Digest",
27 "User" : "Pacman",
28 "Pass" : "Omnomnom",
29 "Parm" : {
30 "qop" : None
31 }
32 }
33 }
34 A_File = WgetFile ("File1", File1, rules=File1_rules)
35 B_File = WgetFile ("File2", File2, rules=File2_rules)
36
37 WGET_OPTIONS = "--user=Pacman --password=Omnomnom"
38 WGET_URLS = [["File1", "File2"]]
39
40 Files = [[A_File, B_File]]
41
42 ExpectedReturnCode = 0
43 ExpectedDownloadedFiles = [A_File, B_File]
44
45 ################ Pre and Post Test Hooks #####################################
46 pre_test = {
47 "ServerFiles" : Files
48 }
49 test_options = {
50 "WgetCommands" : WGET_OPTIONS,
51 "Urls" : WGET_URLS
52 }
53 post_test = {
54 "ExpectedFiles" : ExpectedDownloadedFiles,
55 "ExpectedRetcode" : ExpectedReturnCode
56 }
57
58 err = HTTPTest (
59 pre_hook=pre_test,
60 test_params=test_options,
61 post_hook=post_test
62 ).begin ()
63
64 exit (err)