Files
threshold/internal/tests/cli/boundary/user.bats
T

96 lines
2.2 KiB
Bash

#!/usr/bin/env bats
load _accounts
load _auth
load _users
load _helpers
export NEW_USER='test'
@test "boundary/login: can login as default user" {
run login $DEFAULT_USER
[ "$status" -eq 0 ]
}
@test "boundary/users: can add $NEW_USER user" {
run create_user $NEW_USER
[ "$status" -eq 0 ]
}
@test "boundary/users: can not add already created $NEW_USER user" {
run create_user $NEW_USER
[ "$status" -eq 1 ]
}
@test "boundary/users: can read $NEW_USER user" {
local uid=$(user_id $NEW_USER)
run read_user $uid
[ "$status" -eq 0 ]
}
@test "boundary/account/password: can add $NEW_USER account" {
run create_account $NEW_USER
[ "$status" -eq 0 ]
}
@test "boundary/account/password: can not add already created $NEW_USER account" {
run create_account $NEW_USER
[ "$status" -eq 1 ]
}
@test "boundary/account/password: can read created $NEW_USER account" {
local aid=$(account_id $NEW_USER)
run read_account $aid
[ "$status" -eq 0 ]
}
@test "boundary/user/account-add: can associate $NEW_USER account with $NEW_USER user" {
local uid=$(user_id $NEW_USER)
local aid=$(account_id $NEW_USER)
run assoc_user_acct $aid $uid
[ "$status" -eq 0 ]
}
@test "boundary/login: can login as $NEW_USER user" {
run login $NEW_USER
[ "$status" -eq 0 ]
}
@test "boundary/user: can delete $NEW_USER user" {
login $DEFAULT_USER
local uid=$(user_id $NEW_USER)
run delete_user $uid
[ "$status" -eq 0 ]
}
@test "boundary/user: can not delete already deleted $NEW_USER user" {
login $DEFAULT_USER
local uid=$(user_id $NEW_USER)
run delete_user $uid
[ "$status" -eq 1 ]
}
@test "boundary/users: can not read deleted $NEW_USER user" {
local uid=$(user_id $NEW_USER)
run read_user $uid
[ "$status" -eq 1 ]
}
@test "boundary/account/password: can delete $NEW_USER account" {
local aid=$(account_id $NEW_USER)
run delete_account $aid
[ "$status" -eq 0 ]
}
@test "boundary/account/password: can not delete already deleted $NEW_USER account" {
local aid=$(account_id $NEW_USER)
run delete_account $aid
[ "$status" -eq 1 ]
}
@test "boundary/account/password: can not read deleted $NEW_USER account" {
local aid=$(account_id $NEW_USER)
run read_account $aid
[ "$status" -eq 1 ]
}