test: add tests for authorized-action (#893)

This commit is contained in:
Jeff Malnick authored and GitHub committed 2021-01-29 08:04:46 -08:00
1 parent d65d4dbf6f
commit 10a5f1b832
17 files changed
+216 -13

No files matched your search

+15 -1
View File
@@ -1,3 +1,5 @@
load _authorized_actions
export TGT_NAME='test'
function create_tcp_target() {
@@ -12,7 +14,7 @@ function create_tcp_target() {
}
function read_target() {
boundary targets read -id $1
boundary targets read -id $1 -format json
}
function delete_target() {
@@ -52,3 +54,15 @@ function target_has_host_set_id() {
done
return 1
}
function has_default_target_actions() {
local out=$1
local actions=('read' 'update' 'delete' 'add-host-sets' 'set-host-sets' 'remove-host-sets' 'authorize-session')
for action in ${actions[@]}; do
$(has_authorized_action "$out" "$action") || {
echo "failed to find $action action in output: $out"
return 1
}
done
}