list channels now nearly completely tested
pattern for testing getting fleshed out for real now
This commit is contained in:
parent
e1b0e013b2
commit
f0c7c9c69b
@ -17,4 +17,4 @@ export POST='-X POST'
|
|||||||
export arrows='>>>>>'
|
export arrows='>>>>>'
|
||||||
export line='============='
|
export line='============='
|
||||||
|
|
||||||
crl='curl --silent -i'
|
export crl='curl --silent -i'
|
||||||
|
@ -10,22 +10,26 @@
|
|||||||
# 1. is properly formatted
|
# 1. is properly formatted
|
||||||
# 2. has all the info we need & none we don't
|
# 2. has all the info we need & none we don't
|
||||||
# 3. has basically nothing malicious about it
|
# 3. has basically nothing malicious about it
|
||||||
show_discrepancy() {
|
log_result() {
|
||||||
expect=$1
|
name=$1
|
||||||
actual=$2
|
expect=$2
|
||||||
result=$3
|
actual=$3
|
||||||
|
result=$4
|
||||||
|
|
||||||
|
green='\033[1;32m'
|
||||||
|
red='\033[1;91m'
|
||||||
|
nc='\033[0m'
|
||||||
if [ $expect != $actual ];then
|
if [ $expect != $actual ];then
|
||||||
red='\033[1;91m'
|
|
||||||
nc='\033[0m'
|
|
||||||
echo -e ${red}==========${nc}
|
echo -e ${red}==========${nc}
|
||||||
echo "$result" | sed 's/^/\t/g'
|
echo "$result" | sed 's/^/\t/g'
|
||||||
echo -e ${red}==========${nc}
|
echo -e ${red}==========${nc}
|
||||||
|
else
|
||||||
|
echo -e ${green}${name}${nc} $expect $actual
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
source ./common.sh
|
source ./common.sh
|
||||||
export -f show_discrepancy
|
export -f log_result
|
||||||
echo TestName ExpectedCode ActualCode
|
echo TestName ExpectedCode ActualCode
|
||||||
|
|
||||||
bash ./verify_basic_cases.sh
|
bash ./verify_basic_cases.sh
|
||||||
|
25
server/tests/todo.md
Normal file
25
server/tests/todo.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
Testing happens on a per-modules basis
|
||||||
|
|
||||||
|
# Messages
|
||||||
|
|
||||||
|
All required, none finished
|
||||||
|
|
||||||
|
# Channels
|
||||||
|
|
||||||
|
* list\_all\_channels
|
||||||
|
|
||||||
|
Good and bad users done
|
||||||
|
|
||||||
|
Malicious users not done
|
||||||
|
|
||||||
|
* create\_channel - not done
|
||||||
|
|
||||||
|
* delete\_channel - not ready for testing
|
||||||
|
|
||||||
|
* set\_channel\_attribute - not ready for testing
|
||||||
|
|
||||||
|
# Invites
|
||||||
|
|
||||||
|
* create - not tested
|
||||||
|
|
||||||
|
* use - not tested
|
@ -2,15 +2,21 @@
|
|||||||
|
|
||||||
# Available tests marked with `TEST` - ez grep usage
|
# Available tests marked with `TEST` - ez grep usage
|
||||||
|
|
||||||
active_tests='list_all_channels'
|
active_tests='list_all_channels create_channel'
|
||||||
|
|
||||||
list_all_channels() { # TEST
|
list_all_channels() { # TEST
|
||||||
result=$(curl --silent -i $GET $url/channels/list -d $simple_key)
|
result=$(curl --silent -i $GET $url/channels/list -d $simple_key)
|
||||||
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
||||||
echo "good_list_all_channels" 200 $code
|
log_result "good_list_all_channels" 200 $code "$result"
|
||||||
show_discrepancy 200 $code "$result"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_channel() {
|
||||||
|
echo create_channel 0 0
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_channel() {
|
||||||
|
echo delete_channel 0 0
|
||||||
|
}
|
||||||
if [ -z $1 ];then
|
if [ -z $1 ];then
|
||||||
for cmd in $active_tests;do
|
for cmd in $active_tests;do
|
||||||
$cmd
|
$cmd
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
active_tests='list_all_channels'
|
active_tests='list_channels_no_key list_channels_bad_key'
|
||||||
|
|
||||||
list_all_channels() {
|
list_channels_no_key() {
|
||||||
echo $arrows Test: list_all_channels : no-key
|
result=$($crl $GET $url/channels/list)
|
||||||
curl $GET $url/channels/list
|
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
||||||
echo '\n'$line
|
log_result list_channels_no_key 401 $code "$result"
|
||||||
|
}
|
||||||
|
|
||||||
echo $arrows Test: list_all_channels : wrong-key
|
list_channels_bad_key() {
|
||||||
curl $GET $url/channels/list -d '{"secret":"something else"}'
|
result=$($crl $GET $url/channels/list -d '{"secret":"something else"}')
|
||||||
echo '\n'$line
|
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
||||||
|
log_result list_channels_bad_key 401 $code "$result"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z $1 ];then
|
if [ -z $1 ];then
|
||||||
. ./tests/common.sh
|
|
||||||
echo Running tests $active_tests
|
|
||||||
for cmd in $active_tests;do
|
for cmd in $active_tests;do
|
||||||
$cmd
|
$cmd
|
||||||
done
|
done
|
||||||
|
@ -1,3 +1 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
echo Running mal cases
|
|
||||||
|
Loading…
Reference in New Issue
Block a user