Files
abra/tests/integration/dirs.bats

44 lines
984 B
Bash

#!/usr/bin/env bash
setup(){
load "$PWD/tests/integration/helpers/common"
_common_setup
if [[ -d "$ABRA_DIR" ]]; then
rm -rf "$ABRA_DIR"
fi
}
@test "ABRA_DIR is overriden" {
ABRA_DIR="$HOME/.abra_foo"
run $ABRA app ls
# no servers yet, so will fail. however, it will run the required code which
# checks if it should create these base directories and that is what we want
assert_failure
assert_exists "$HOME/.abra_foo"
run rm -rf "$ABRA_DIR"
assert_success
}
@test "abra directories are created" {
run $ABRA app ls
# NOTE(d1): no servers yet, so will fail. however, it will run the required
# code which checks if it should create these base directories and that is
# what we want
assert_failure
assert_exists "$ABRA_DIR"
assert_exists "$ABRA_DIR/servers"
assert_exists "$ABRA_DIR/recipes"
assert_not_exists "$ABRA_DIR/catalogue"
server_dir_perms=$(stat -c "%a" "$ABRA_DIR/servers")
assert_equal $server_dir_perms "700"
}