50 lines
712 B
Bash
50 lines
712 B
Bash
#! /bin/bash
|
|
|
|
test_name="Path Test"
|
|
|
|
config_file="default.config"
|
|
port=4040
|
|
host="localhost"
|
|
|
|
#paths=("/" "/test" "/test/" "/list" "list" "/wrong") # you can add many
|
|
paths=("/") # you can add many
|
|
methods=("GET" "POST" "DELETE")
|
|
#methods=("GET")
|
|
httpz=("HTTP/1.1")
|
|
|
|
|
|
|
|
l1="${methods[0]} ${paths[0]} ${httpz[0]}"
|
|
|
|
header="Host: $host"
|
|
body=
|
|
|
|
|
|
run_this_test()
|
|
{
|
|
|
|
for i in "${paths[@]}"
|
|
do
|
|
l1="${methods[0]} $i ${httpz[0]}"
|
|
request="$l1\n$header\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...
|
|
|
|
|
|
expected_result_file="./expected_results/expected_path_test.txt"
|
|
|
|
|
|
|