1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2024-10-27 20:34:27 +00:00
TheLocehiliosan_yadm/test/001_unit_configure_paths.bats
Tim Byrne d2cd3b1b26 Add tests
Tests will be run using `bats`.
2016-04-07 08:14:13 -05:00

67 lines
2.0 KiB
Bash

load common
load_fixtures
@test "configure_paths() (standard YADM_DIR)" {
echo "
Correct paths should be defined
YADM_REPO=$DEFAULT_YADM_DIR/$DEFAULT_REPO
YADM_CONFIG=$DEFAULT_YADM_DIR/$DEFAULT_CONFIG
YADM_ENCRYPT=$DEFAULT_YADM_DIR/$DEFAULT_ENCRYPT
YADM_ARCHIVE=$DEFAULT_YADM_DIR/$DEFAULT_ARCHIVE
GIT_DIR=$DEFAULT_YADM_DIR/$DEFAULT_REPO
"
#; load yadm functions
YADM_TEST=1 source $T_YADM
#; configure the paths
configure_paths
echo "CONFIGURED PATHS:"
echo " YADM_REPO:$YADM_REPO"
echo " YADM_CONFIG:$YADM_CONFIG"
echo "YADM_ENCRYPT:$YADM_ENCRYPT"
echo "YADM_ARCHIVE:$YADM_ARCHIVE"
echo " GIT_DIR:$GIT_DIR"
#; test value of configured paths
[ "$DEFAULT_YADM_DIR/$DEFAULT_REPO" = "$YADM_REPO" ]
[ "$DEFAULT_YADM_DIR/$DEFAULT_CONFIG" = "$YADM_CONFIG" ]
[ "$DEFAULT_YADM_DIR/$DEFAULT_ENCRYPT" = "$YADM_ENCRYPT" ]
[ "$DEFAULT_YADM_DIR/$DEFAULT_ARCHIVE" = "$YADM_ARCHIVE" ]
[ "$DEFAULT_YADM_DIR/$DEFAULT_REPO" = "$GIT_DIR" ]
}
@test "configure_paths() (custom YADM_DIR)" {
echo "
Correct paths should be defined
YADM_REPO=$T_DIR_YADM/$DEFAULT_REPO
YADM_CONFIG=$T_DIR_YADM/$DEFAULT_CONFIG
YADM_ENCRYPT=$T_DIR_YADM/$DEFAULT_ENCRYPT
YADM_ARCHIVE=$T_DIR_YADM/$DEFAULT_ARCHIVE
GIT_DIR=$T_DIR_YADM/$DEFAULT_REPO
"
#; load yadm functions
YADM_TEST=1 source $T_YADM
#; configure the paths
TEST_ARGS=(-Y $T_DIR_YADM)
process_global_args ${TEST_ARGS[*]}
configure_paths
echo "CONFIGURED PATHS:"
echo " YADM_REPO:$YADM_REPO"
echo " YADM_CONFIG:$YADM_CONFIG"
echo "YADM_ENCRYPT:$YADM_ENCRYPT"
echo "YADM_ARCHIVE:$YADM_ARCHIVE"
echo " GIT_DIR:$GIT_DIR"
#; test value of configured paths
[ "$T_DIR_YADM/$DEFAULT_REPO" = "$YADM_REPO" ]
[ "$T_DIR_YADM/$DEFAULT_CONFIG" = "$YADM_CONFIG" ]
[ "$T_DIR_YADM/$DEFAULT_ENCRYPT" = "$YADM_ENCRYPT" ]
[ "$T_DIR_YADM/$DEFAULT_ARCHIVE" = "$YADM_ARCHIVE" ]
[ "$T_DIR_YADM/$DEFAULT_REPO" = "$GIT_DIR" ]
}