1#!/usr/bin/env python3
2from sys import exit
3from test.http_test import HTTPTest
4from misc.wget_file import WgetFile
5
6"""
7    This test ensures Wget's Digest Authorization Negotiation.
8"""
9TEST_NAME = "Digest Authorization"
10############# File Definitions ###############################################
11File1 = "Need a cookie?"
12
13File1_rules = {
14    "Authentication"    : {
15        "Type"          : "Digest",
16        "User"          : "Pacman",
17        "Pass"          : "Omnomnom"
18    }
19}
20A_File = WgetFile ("File1", File1, rules=File1_rules)
21
22WGET_OPTIONS = "--user=Pacman --password=Omnomnom"
23WGET_URLS = [["File1"]]
24
25Files = [[A_File]]
26
27ExpectedReturnCode = 0
28ExpectedDownloadedFiles = [A_File]
29
30################ Pre and Post Test Hooks #####################################
31pre_test = {
32    "ServerFiles"       : Files
33}
34test_options = {
35    "WgetCommands"      : WGET_OPTIONS,
36    "Urls"              : WGET_URLS
37}
38post_test = {
39    "ExpectedFiles"     : ExpectedDownloadedFiles,
40    "ExpectedRetcode"   : ExpectedReturnCode
41}
42
43err = HTTPTest (
44                name=TEST_NAME,
45                pre_hook=pre_test,
46                test_params=test_options,
47                post_hook=post_test
48).begin ()
49
50exit (err)
51