Tester is much better, ready for tests to be added
This commit is contained in:
83
Tester/test_header.sh
Normal file
83
Tester/test_header.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#! /bin/bash
|
||||
|
||||
test_name="Header Test"
|
||||
|
||||
config_file="test1.config"
|
||||
port=4040
|
||||
host="localhost"
|
||||
|
||||
paths=("/") # you can add many
|
||||
#methods=("GET" "POST" "DELETE")
|
||||
methods=("GET")
|
||||
httpz=("HTTP/1.1")
|
||||
|
||||
|
||||
|
||||
|
||||
# the parts we will send to webserv
|
||||
|
||||
|
||||
# let main.sh handle the l1
|
||||
|
||||
l1="${methods[0]} ${paths[0]} ${httpz[0]}"
|
||||
|
||||
header="Host: $host\n"
|
||||
header+="Nonsense: fu\n"
|
||||
|
||||
header_cycle=("Transfer-encoding: fu" "Content-encoding: fu")
|
||||
|
||||
#header+="Transfer-encoding: fu\n"
|
||||
#header+="Content-endcoding: fu\n"
|
||||
body=
|
||||
|
||||
|
||||
run_this_test()
|
||||
{
|
||||
|
||||
for i in "${header_cycle[@]}"
|
||||
do
|
||||
header_send="$header$i"
|
||||
request="$l1\n$header_send\n$body\n"
|
||||
{
|
||||
echo "----- $test_name -----"
|
||||
echo -e "$_RED$request$_END"
|
||||
} >> telnet.out
|
||||
echo -e "$request"
|
||||
sleep 1
|
||||
echo -e "\n\n" >> telnet.out
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
# expected result...
|
||||
|
||||
files=()
|
||||
|
||||
file="expected_header_test.txt"
|
||||
files+=("expected_header_test.txt")
|
||||
#files+=("expected_path_root_test.txt")
|
||||
|
||||
|
||||
local_expected_test_files=()
|
||||
test_path=""
|
||||
|
||||
add_path()
|
||||
{
|
||||
for i in "${files[@]}"
|
||||
do
|
||||
local_expected_test_files+=("$test_path$i")
|
||||
done
|
||||
}
|
||||
|
||||
#add_path
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user