summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-23 18:46:42 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-23 18:46:42 +0200
commit69eb9f153155fbb0af1305e1de2f5ee57dbcce49 (patch)
treebe4697560dabfe724e2ccc172fc24942c593682c /tests
parent685d094023e2edbd130a7c86d46e7fd79a62e8af (diff)
downloadpass-69eb9f153155fbb0af1305e1de2f5ee57dbcce49.tar.gz
pass-69eb9f153155fbb0af1305e1de2f5ee57dbcce49.tar.bz2
pass-69eb9f153155fbb0af1305e1de2f5ee57dbcce49.zip
tests: expand move tests
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0050-mv-tests.sh44
1 files changed, 39 insertions, 5 deletions
diff --git a/tests/t0050-mv-tests.sh b/tests/t0050-mv-tests.sh
index 1b1fef2..9362666 100755
--- a/tests/t0050-mv-tests.sh
+++ b/tests/t0050-mv-tests.sh
@@ -1,16 +1,50 @@
#!/bin/bash
-test_description='Test mv'
+test_description='Test mv command'
. ./setup.sh
-TEST_CRED="test_cred"
-TEST_CRED_NEW="test_cred_new"
+INITIAL_PASSWORD="bla bla bla will we make it!!"
-test_expect_success 'Test "mv" command' '
+test_expect_success 'Basic move command' '
pass init $KEY1 &&
- pass generate cred1 39 &&
+ pass git init &&
+ pass insert -e cred1 <<<"$INITIAL_PASSWORD" &&
pass mv cred1 cred2 &&
[[ -e $PASSWORD_STORE_DIR/cred2.gpg && ! -e $PASSWORD_STORE_DIR/cred1.gpg ]]
'
+test_expect_success 'Directory creation' '
+ pass mv cred2 directory/ &&
+ [[ -d $PASSWORD_STORE_DIR/directory && -e $PASSWORD_STORE_DIR/directory/cred2.gpg ]]
+'
+
+test_expect_success 'Directory creation with file rename and empty directory removal' '
+ pass mv directory/cred2 newdirectory/cred &&
+ [[ -d $PASSWORD_STORE_DIR/newdirectory && -e $PASSWORD_STORE_DIR/newdirectory/cred.gpg && ! -e $PASSWORD_STORE_DIR/directory ]]
+'
+
+test_expect_success 'Directory rename' '
+ pass mv newdirectory anotherdirectory &&
+ [[ -d $PASSWORD_STORE_DIR/anotherdirectory && -e $PASSWORD_STORE_DIR/anotherdirectory/cred.gpg && ! -e $PASSWORD_STORE_DIR/newdirectory ]]
+'
+
+test_expect_success 'Directory move into new directory' '
+ pass mv anotherdirectory newdirectory/ &&
+ [[ -d $PASSWORD_STORE_DIR/newdirectory/anotherdirectory && -e $PASSWORD_STORE_DIR/newdirectory/anotherdirectory/cred.gpg && ! -e $PASSWORD_STORE_DIR/anotherdirectory ]]
+'
+
+test_expect_success 'Multi-directory creation and multi-directory empty removal' '
+ pass mv newdirectory/anotherdirectory/cred new1/new2/new3/new4/thecred &&
+ pass mv new1/new2/new3/new4/thecred cred &&
+ [[ ! -d $PASSWORD_STORE_DIR/newdirectory/anotherdirectory && ! -d $PASSWORD_STORE_DIR/new1/new2/new3/new4 && -e $PASSWORD_STORE_DIR/cred.gpg ]]
+'
+
+test_expect_success 'Password made it until the end' '
+ [[ $(pass show cred) == "$INITIAL_PASSWORD" ]]
+'
+
+test_expect_success 'Git is consistent' '
+ [[ -z $(git status --porcelain 2>&1) ]]
+'
+
test_done