1#!/usr/bin/env python3 2from sys import exit 3from test.http_test import HTTPTest 4from misc.wget_file import WgetFile 5 6""" 7 Simple test for HTTP POST Requests usiong the --method command 8""" 9TEST_NAME = "HTTP POST Requests" 10############# File Definitions ############################################### 11File1 = """A reader lives a thousand lives before he dies, said Jojen. 12The man who never reads lives only one""" 13 14File1_response = """A reader lives a thousand lives before he dies, said Jojen. 15The man who never reads lives only one 16TestMessage""" 17 18A_File = WgetFile ("File1", File1) 19 20WGET_OPTIONS = "--method=post --body-data=TestMessage" 21WGET_URLS = [["File1"]] 22 23Files = [[A_File]] 24 25ExpectedReturnCode = 0 26ExpectedDownloadedFiles = [WgetFile ("File1", File1_response)] 27 28################ Pre and Post Test Hooks ##################################### 29pre_test = { 30 "ServerFiles" : Files 31} 32test_options = { 33 "WgetCommands" : WGET_OPTIONS, 34 "Urls" : WGET_URLS 35} 36post_test = { 37 "ExpectedFiles" : ExpectedDownloadedFiles, 38 "ExpectedRetcode" : ExpectedReturnCode 39} 40 41err = HTTPTest ( 42 name=TEST_NAME, 43 pre_hook=pre_test, 44 test_params=test_options, 45 post_hook=post_test 46).begin () 47 48exit (err) 49