fix: correct tests and handle a few edge cases in remote command usage
This commit is contained in:
@@ -168,11 +168,18 @@ main() {
|
|||||||
remote:remove)
|
remote:remove)
|
||||||
shift 1
|
shift 1
|
||||||
git remote remove "$@"
|
git remote remove "$@"
|
||||||
exit "$?"
|
local exit_code="$?"
|
||||||
|
if [[ "$(git config dokku.remote)" == "$1" ]]; then
|
||||||
|
git config --unset dokku.remote
|
||||||
|
fi
|
||||||
|
exit "$exit_code"
|
||||||
;;
|
;;
|
||||||
remote:unset)
|
remote:unset)
|
||||||
git config --unset dokku.remote
|
if [[ -n "$(git config dokku.remote)" ]]; then
|
||||||
exit "$?"
|
git config --unset dokku.remote
|
||||||
|
exit "$?"
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -265,13 +265,12 @@ teardown() {
|
|||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
assert_success
|
||||||
assert_output "dokku2"
|
|
||||||
|
|
||||||
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:list"
|
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:list"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
assert_success
|
||||||
assert_output "dokku\dokku2"
|
assert_output "$(printf "dokku\ndokku2")"
|
||||||
|
|
||||||
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:remove dokku2"
|
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:remove dokku2"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
@@ -289,6 +288,11 @@ teardown() {
|
|||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:unset"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote"
|
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
|
|||||||
Reference in New Issue
Block a user