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 that Wget returns the correct return code when sent 8 a 403 Forbidden by the Server. 9""" 10 11TEST_NAME = "Forbidden Retcode" 12 13############# File Definitions ############################################### 14File1 = "Apples and Oranges? Really?" 15 16File1_rules = { 17 "Response" : 403 18} 19 20A_File = WgetFile ("File1", File1, rules=File1_rules) 21 22WGET_OPTIONS = "" 23WGET_URLS = [["File1"]] 24 25Files = [[A_File]] 26 27ExpectedReturnCode = 8 28ExpectedDownloadedFiles = [] 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