From 2b70d37370c31d55bfa1da95fecbcd04a9c5bfa7 Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 13 Jul 2020 21:14:57 -0700 Subject: [PATCH] start of basic api tests, all tests still individually runnable --- server/tests/common.sh | 15 +++++++++++++++ server/tests/{curl-admin.sh => main.sh} | 8 -------- server/tests/status.md | 19 +++++++++++++++++++ server/tests/verify_basic_cases.sh | 21 ++++++++++++++++++++- 4 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 server/tests/common.sh rename server/tests/{curl-admin.sh => main.sh} (74%) create mode 100644 server/tests/status.md diff --git a/server/tests/common.sh b/server/tests/common.sh new file mode 100644 index 0000000..5635dd6 --- /dev/null +++ b/server/tests/common.sh @@ -0,0 +1,15 @@ +# Details for our bs user when testing things +export id=1 +export secret=secret +export name=godrah +export joindate=123 +export status=1 +export permissions=69 + +export simple_key='{"secret":"secret"}' + +export url='localhost:8888' + +export GET='-X GET' +export POST='-X POST' + diff --git a/server/tests/curl-admin.sh b/server/tests/main.sh similarity index 74% rename from server/tests/curl-admin.sh rename to server/tests/main.sh index afdb42b..edab906 100644 --- a/server/tests/curl-admin.sh +++ b/server/tests/main.sh @@ -1,13 +1,5 @@ #!/bin/sh -# Details for our bs user when testing things -export id=1 -export secret=secret -export name=godrah -export joindate=123 -export status=1 -export permissions=69 - # This script is basically just a convenient launch pad script for running all # the tests at once # Most tests should be runnable by doing ./script.sh name_of_test diff --git a/server/tests/status.md b/server/tests/status.md new file mode 100644 index 0000000..8211e23 --- /dev/null +++ b/server/tests/status.md @@ -0,0 +1,19 @@ +# State of Tests + +Here is a description of what is passing and what is failing where + +## Full passes + +_Nothing for now_ + +## Basic Passes + +_Nothing for now_ + +## Err Passes + +_Nothing for now_ + +## Mal Passes + +_Nothing for now_ diff --git a/server/tests/verify_basic_cases.sh b/server/tests/verify_basic_cases.sh index 79a248e..2d456f3 100644 --- a/server/tests/verify_basic_cases.sh +++ b/server/tests/verify_basic_cases.sh @@ -1,3 +1,22 @@ #!/bin/sh -echo Basic tests here +# Available tests marked with `TEST` + +active_tests='list_all_channels' + +list_all_channels() { # TEST + #echo curl $GET $url/channels/list -d $simple_key + curl $GET $url/channels/list -d $simple_key +} + +if [ -z $1 ];then + . ./tests/common.sh + echo Running tests $active_tests + for cmd in $active_tests;do + $cmd + done +else + for cmd in $@;do + $cmd + done +fi