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