76 lines
1.2 KiB
Bash
76 lines
1.2 KiB
Bash
#! /bin/bash
|
|
|
|
test_name="Delete Test"
|
|
|
|
config_file="./Tester/test1.config"
|
|
port=4040
|
|
host="localhost"
|
|
|
|
#paths=("/" "/test" "/test/" "/list" "list" "/wrong") # you can add many
|
|
paths=("/" "/to_delete.txt" "/i_do_not_exist.txt") # you can add many
|
|
#methods=("GET" "POST" "DELETE")
|
|
methods=("DELETE")
|
|
httpz=("HTTP/1.1")
|
|
|
|
|
|
|
|
l1="${methods[0]} ${paths[0]} ${httpz[0]}"
|
|
|
|
header="Host: $host"
|
|
body=
|
|
|
|
|
|
run_this_test()
|
|
{
|
|
|
|
echo "we will delete" > ./Tester/www/to_delete.txt
|
|
|
|
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.log
|
|
echo -e "$request"
|
|
sleep 1
|
|
echo -e "\n" >> telnet.log
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# expected result...
|
|
|
|
|
|
files=()
|
|
|
|
file="expected_delete_test.txt"
|
|
#files+=("expected_path_root_test.txt")
|
|
#files+=("expected_path_testnoslash_test.txt")
|
|
#files+=("expected_path_testslash_test.txt")
|
|
#files+=("expected_path_list_test.txt")
|
|
#files+=("expected_path_badlist_test.txt")
|
|
#files+=("expected_path_wrong_test.txt")
|
|
|
|
|
|
#local_expected_test_file=$file
|
|
local_expected_test_files=()
|
|
test_path=""
|
|
|
|
add_path()
|
|
{
|
|
for i in "${files[@]}"
|
|
do
|
|
local_expected_test_files+=("$test_path$i")
|
|
done
|
|
}
|
|
|
|
#add_path
|
|
|
|
|
|
|
|
|