summaryrefslogtreecommitdiff
path: root/tests/t0050-mv-tests.sh
blob: 936266699630e8026e350e6b7cc9a575beaa985e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

test_description='Test mv command'
. ./setup.sh

INITIAL_PASSWORD="bla bla bla will we make it!!"

test_expect_success 'Basic move command' '
	pass init $KEY1 &&
	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
df5a07890af661ba7a2be6588a&follow=1'>darwin: allow for gnu mktemp in pathJason A. Donenfeld1-1/+1 2014-06-30tmpdir: more cross platform solution, and .txt file endingJason A. Donenfeld1-4/+3 2014-06-29passmenu: type text with xdotoolJason A. Donenfeld2-3/+17 2014-06-29edit: Don't go into a crazy loop. Instead prompt.Jason A. Donenfeld1-2/+1 2014-06-29git: do not trap tmpdir removalJason A. Donenfeld1-1/+0 2014-06-29darwin: fix mktemp argument orderJason A. Donenfeld1-1/+1 2014-06-29darwin: properly ejects ramdisksJason A. Donenfeld2-15/+20 2014-06-29Allow options in EDITOR variableJason A. Donenfeld2-2/+3 2014-06-29keepassx2pass: Substitute empty string for NoneAndrew Spiers1-1/+4 2014-06-16emacs: Use PASSWORD_STORE_CLIP_TIME env variableSvend Sorensen1-4/+7 2014-06-16emacs: Use when instead of if/prognSvend Sorensen1-5/+4 2014-06-16emacs: Update pass website URLSvend Sorensen1-1/+1 2014-05-27Update for new URL.Jason A. Donenfeld3-3/+3 2014-05-14Bump version1.6.2Jason A. Donenfeld1-1/+1 2014-05-14Don't define tmpdir on git init.Jason A. Donenfeld1-4/+3 2014-05-14Disable secmem warning when discovering keysmilki2-2/+2 2014-05-10edit: Quote editor so tests work in spaced directories.Jason A. Donenfeld1-1/+1 2014-05-10reencryption: Properly escape input to sedJason A. Donenfeld1-1/+1 2014-05-10git: use secure tmp directoryJason A. Donenfeld1-4/+11 2014-05-10configure git to decrypt gpg files automaticallySamuel Le Thiec1-0/+5 2014-05-08completion: add new generate flagsJason A. Donenfeld3-2/+7 2014-05-08inplace: mutually exclusive with forceJason A. Donenfeld2-3/+3 2014-05-08usage: tab to spacesJason A. Donenfeld1-1/+1 2014-05-08generate: use nice ansi colors instead.Jason A. Donenfeld1-3/+2 2014-05-08zsh: posix compatible sed fix for zsh-completionJason A. Donenfeld1-1/+1 2014-05-07Implement interactive init functionSvend Sorensen1-0/+8 2014-05-07Implement interactive rename functionSvend Sorensen1-0/+7 2014-05-07Reorder interactive function to match order of helper functionsSvend Sorensen1-13/+13 2014-05-07Make edit helper function name consistent with other helpersSvend Sorensen1-1/+1 2014-05-07Factor out password completing-read functionSvend Sorensen1-4/+8 2014-05-07Add dash to Package-RequiresSvend Sorensen1-1/+1 2014-05-06Force sane sort order.Jason A. Donenfeld1-2/+2 2014-05-06generate: add --in-place optionJason A. Donenfeld4-9/+33