| 1 |
#!/usr/bin/env python3 |
| 2 |
from sys import exit |
| 3 |
from test.http_test import HTTPTest |
| 4 |
from test.base_test import HTTPS, SKIP_TEST |
| 5 |
from misc.wget_file import WgetFile |
| 6 |
import os |
| 7 |
|
| 8 |
""" |
| 9 |
This test ensures that Wget can download files from HTTPS Servers |
| 10 |
""" |
| 11 |
if os.getenv('SSL_TESTS') is None: |
| 12 |
exit (SKIP_TEST) |
| 13 |
|
| 14 |
############# File Definitions ############################################### |
| 15 |
File1 = "Would you like some Tea?" |
| 16 |
File2 = "With lemon or cream?" |
| 17 |
|
| 18 |
A_File = WgetFile ("File1", File1) |
| 19 |
B_File = WgetFile ("File2", File2) |
| 20 |
|
| 21 |
WGET_OPTIONS = "--no-check-certificate --pinnedpubkey=sha256//invalid" |
| 22 |
WGET_URLS = [["File1", "File2"]] |
| 23 |
|
| 24 |
Files = [[A_File, B_File]] |
| 25 |
|
| 26 |
Servers = [HTTPS] |
| 27 |
|
| 28 |
ExpectedReturnCode = 5 |
| 29 |
ExpectedDownloadedFiles = [] |
| 30 |
|
| 31 |
################ Pre and Post Test Hooks ##################################### |
| 32 |
pre_test = { |
| 33 |
"ServerFiles" : Files |
| 34 |
} |
| 35 |
test_options = { |
| 36 |
"WgetCommands" : WGET_OPTIONS, |
| 37 |
"Urls" : WGET_URLS |
| 38 |
} |
| 39 |
post_test = { |
| 40 |
"ExpectedFiles" : ExpectedDownloadedFiles, |
| 41 |
"ExpectedRetcode" : ExpectedReturnCode |
| 42 |
} |
| 43 |
|
| 44 |
err = HTTPTest ( |
| 45 |
pre_hook=pre_test, |
| 46 |
test_params=test_options, |
| 47 |
post_hook=post_test, |
| 48 |
protocols=Servers |
| 49 |
).begin () |
| 50 |
|
| 51 |
exit (err) |