setup.sh (1917B)
1 # This file should be sourced by all test-scripts 2 # 3 # This scripts sets the following: 4 # $PASS Full path to password-store script to test 5 # $GPG Name of gpg executable 6 # $KEY{1..5} GPG key ids of testing keys 7 # $TEST_HOME This folder 8 9 10 # Unset config vars 11 unset PASSWORD_STORE_DIR 12 unset PASSWORD_STORE_KEY 13 unset PASSWORD_STORE_GIT 14 unset PASSWORD_STORE_GPG_OPTS 15 unset PASSWORD_STORE_X_SELECTION 16 unset PASSWORD_STORE_CLIP_TIME 17 unset PASSWORD_STORE_UMASK 18 unset PASSWORD_STORE_GENERATED_LENGTH 19 unset PASSWORD_STORE_CHARACTER_SET 20 unset PASSWORD_STORE_CHARACTER_SET_NO_SYMBOLS 21 unset PASSWORD_STORE_ENABLE_EXTENSIONS 22 unset PASSWORD_STORE_EXTENSIONS_DIR 23 unset PASSWORD_STORE_SIGNING_KEY 24 unset EDITOR 25 26 # We must be called from tests/ 27 TEST_HOME="$(pwd)" 28 29 . ./sharness.sh 30 31 export PASSWORD_STORE_DIR="$SHARNESS_TRASH_DIRECTORY/test-store/" 32 rm -rf "$PASSWORD_STORE_DIR" 33 mkdir -p "$PASSWORD_STORE_DIR" 34 if [[ ! -d $PASSWORD_STORE_DIR ]]; then 35 echo "Could not create $PASSWORD_STORE_DIR" 36 exit 1 37 fi 38 39 export GIT_DIR="$PASSWORD_STORE_DIR/.git" 40 export GIT_WORK_TREE="$PASSWORD_STORE_DIR" 41 git config --global user.email "Pass-Automated-Testing-Suite@zx2c4.com" 42 git config --global user.name "Pass Automated Testing Suite" 43 44 45 PASS="$TEST_HOME/../src/password-store.sh" 46 if [[ ! -e $PASS ]]; then 47 echo "Could not find password-store.sh" 48 exit 1 49 fi 50 51 # Note: the assumption is the test key is unencrypted. 52 export GNUPGHOME="$TEST_HOME/gnupg/" 53 chmod 700 "$GNUPGHOME" 54 GPG="gpg" 55 command -v gpg2 &>/dev/null && GPG="gpg2" 56 57 # We don't want any currently running agent to conflict. 58 unset GPG_AGENT_INFO 59 60 KEY1="D4C78DB7920E1E27F5416B81CC9DB947CF90C77B" # pass test key 1 61 KEY2="70BD448330ACF0653645B8F2B4DDBFF0D774A374" # pass test key 2 62 KEY3="62EBE74BE834C2EC71E6414595C4B715EB7D54A8" # pass test key 3 63 KEY4="9378267629F989A0E96677B7976DD3D6E4691410" # pass test key 4 64 KEY5="4D2AFBDE67C60F5999D143AFA6E073D439E5020C" # pass test key 5