tests: add host catalog CLI tests (#639)

This commit is contained in:
Jeff Malnick authored and GitHub committed 2020-10-12 16:44:45 -07:00
1 parent dcb609b831
commit bee1412785
2 files changed
+62 -5

No files matched your search

@@ -1,15 +1,19 @@
function create_host_catalog() {
local sid=$1
local name=$2
boundary host-catalogs create static -scope-id $sid -name $name -description 'test host catalog'
local name=$1
local sid=$2
echo "sid $sid"
boundary host-catalogs create static \
-scope-id $sid \
-name $name \
-description 'test host catalog'
}
function read_host_catalog() {
boundary hosts read -id $1
boundary host-catalogs read -id $1
}
function delete_host_catalog() {
boundary hosts delete -id $1
boundary host-catalogs delete -id $1
}
function list_host_catalogs() {
@@ -0,0 +1,53 @@
#!/usr/bin/env bats
load _auth
load _host_catalogs
load _helpers
export NEW_HOST_CATALOG='test'
@test "boundary/login: can login as default user" {
run login $DEFAULT_USER
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/hosts-catalogs: can create $NEW_HOST_CATALOG host catalog in default project scope" {
run create_host_catalog $NEW_HOST_CATALOG $DEFAULT_P_ID
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/hosts: can not create already created $NEW_HOST_CATALOG host catalog in default project scope" {
run create_host_catalog $NEW_HOST_CATALOG
echo "$output"
[ "$status" -eq 1 ]
}
@test "boundary/hosts: can read $NEW_HOST_CATALOG host catalog in default project scope" {
local hid=$(host_catalog_id $NEW_HOST_CATALOG $DEFAULT_P_ID)
run read_host_catalog $hid
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/host: can delete $NEW_HOST_CATALOG host in default project scope" {
local hid=$(host_catalog_id $NEW_HOST_CATALOG $DEFAULT_P_ID)
run delete_host_catalog $hid
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/host: can not delete already deleted $NEW_HOST_CATALOG host in default project scope" {
local hid=$(host_catalog_id $NEW_HOST_CATALOG $DEFAULT_P_ID)
run delete_host_catalog $hid
echo "$output"
[ "$status" -eq 1 ]
}
@test "boundary/hosts: can not read deleted $NEW_HOST_CATALOG host in default project scope" {
local hid=$(host_catalog_id $NEW_HOST_CATALOG $DEFAULT_P_ID)
run read_host_catalog $hid
echo "$output"
[ "$status" -eq 1 ]
}