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 21WGET_OPTIONS = "--no-check-certificate --pinnedpubkey=sha256//invalid" 22WGET_URLS = [["File1", "File2"]] 23 24Files = [[A_File, B_File]] 25 26Servers = [HTTPS] 27 28ExpectedReturnCode = 5 29ExpectedDownloadedFiles = [] 30 31################ Pre and Post Test Hooks ##################################### 32pre_test = { 33 "ServerFiles" : Files 34} 35test_options = { 36 "WgetCommands" : WGET_OPTIONS, 37 "Urls" : WGET_URLS 38} 39post_test = { 40 "ExpectedFiles" : ExpectedDownloadedFiles, 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