#!/bin/bash # Tests for ready command this_dir="$(cd "$(dirname "$0")" && pwd)" source "${this_dir}/common.sh" test_ready_with_key() { assert_success szecret ready pass "ready succeeds with private key" } test_ready_without_key() { local saved_key="${SZECRET_PRIVATE_KEY}" export SZECRET_PRIVATE_KEY="${TEST_DIR}/nonexistent-key" assert_failure szecret ready export SZECRET_PRIVATE_KEY="${saved_key}" pass "ready fails without private key" } run_tests() { test_ready_with_key test_ready_without_key } [[ "${BASH_SOURCE[0]}" == "${0}" ]] && run_tests