| 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 credentials |
| 8 |
are provided in-URL |
| 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 http://Pacman:Omnomnom@localhost:{{port}}/File1" |
| 26 |
WGET_URLS = [[]] |
| 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) |