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 line='============='
|
||||
|
||||
crl='curl --silent -i'
|
||||
export crl='curl --silent -i'
|
||||
|
@ -10,22 +10,26 @@
|
||||
# 1. is properly formatted
|
||||
# 2. has all the info we need & none we don't
|
||||
# 3. has basically nothing malicious about it
|
||||
show_discrepancy() {
|
||||
expect=$1
|
||||
actual=$2
|
||||
result=$3
|
||||
log_result() {
|
||||
name=$1
|
||||
expect=$2
|
||||
actual=$3
|
||||
result=$4
|
||||
|
||||
green='\033[1;32m'
|
||||
red='\033[1;91m'
|
||||
nc='\033[0m'
|
||||
if [ $expect != $actual ];then
|
||||
red='\033[1;91m'
|
||||
nc='\033[0m'
|
||||
echo -e ${red}==========${nc}
|
||||
echo "$result" | sed 's/^/\t/g'
|
||||
echo -e ${red}==========${nc}
|
||||
else
|
||||
echo -e ${green}${name}${nc} $expect $actual
|
||||
fi
|
||||
}
|
||||
|
||||
source ./common.sh
|
||||
export -f show_discrepancy
|
||||
export -f log_result
|
||||
echo TestName ExpectedCode ActualCode
|
||||
|
||||
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
|
||||
|
||||
active_tests='list_all_channels'
|
||||
active_tests='list_all_channels create_channel'
|
||||
|
||||
list_all_channels() { # TEST
|
||||
result=$(curl --silent -i $GET $url/channels/list -d $simple_key)
|
||||
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
||||
echo "good_list_all_channels" 200 $code
|
||||
show_discrepancy 200 $code "$result"
|
||||
log_result "good_list_all_channels" 200 $code "$result"
|
||||
}
|
||||
|
||||
create_channel() {
|
||||
echo create_channel 0 0
|
||||
}
|
||||
|
||||
delete_channel() {
|
||||
echo delete_channel 0 0
|
||||
}
|
||||
if [ -z $1 ];then
|
||||
for cmd in $active_tests;do
|
||||
$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() {
|
||||
echo $arrows Test: list_all_channels : no-key
|
||||
curl $GET $url/channels/list
|
||||
echo '\n'$line
|
||||
list_channels_no_key() {
|
||||
result=$($crl $GET $url/channels/list)
|
||||
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
||||
log_result list_channels_no_key 401 $code "$result"
|
||||
}
|
||||
|
||||
echo $arrows Test: list_all_channels : wrong-key
|
||||
curl $GET $url/channels/list -d '{"secret":"something else"}'
|
||||
echo '\n'$line
|
||||
list_channels_bad_key() {
|
||||
result=$($crl $GET $url/channels/list -d '{"secret":"something else"}')
|
||||
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
||||
log_result list_channels_bad_key 401 $code "$result"
|
||||
}
|
||||
|
||||
if [ -z $1 ];then
|
||||
. ./tests/common.sh
|
||||
echo Running tests $active_tests
|
||||
for cmd in $active_tests;do
|
||||
$cmd
|
||||
done
|
||||
|
@ -1,3 +1 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo Running mal cases
|
||||
#!/bin/bash
|
||||
|
Loading…
Reference in New Issue
Block a user