aboutsummaryrefslogtreecommitdiffstats
path: root/jsaccess/tests/test_store_local.sh
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-06-18 03:52:07 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-06-18 03:52:07 +0200
commit9b087ec220c4da8cf962a886d66706efb6394bc9 (patch)
treeb3dab577b34770a1f4dfb9b056d4cda69179f5ea /jsaccess/tests/test_store_local.sh
parentjsaccess: WIP store, getting there (diff)
downloadlaurent-tools-9b087ec220c4da8cf962a886d66706efb6394bc9.tar.xz
laurent-tools-9b087ec220c4da8cf962a886d66706efb6394bc9.zip
jsaccess: store.sh working + unittests
Diffstat (limited to '')
-rwxr-xr-xjsaccess/tests/test_store_local.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/jsaccess/tests/test_store_local.sh b/jsaccess/tests/test_store_local.sh
new file mode 100755
index 0000000..0cec47a
--- /dev/null
+++ b/jsaccess/tests/test_store_local.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Unittests for jsaccess store.sh
+
+storesh=../store.sh
+TMP=tmp
+export JSA_PASS=jsa_unittest_passphrase
+export JSA_FORCE=1
+
+$storesh init store ||exit 1
+[ -d store ] ||exit 2
+
+$storesh add example.txt ||exit 10
+[ -d /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 11
+[ -f /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 12
+
+$storesh ls > $TMP ||exit 20
+[ `grep -c "example.txt" $TMP` -eq 1 ] || exit 21
+rm $TMP
+
+$storesh rm example.txt ||exit 30
+[ ! -f /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 31
+
+$storesh ls > $TMP ||exit 40
+[ `grep -c "example.txt" $TMP` -eq 0 ] || exit 41
+rm $TMP
+
+$storesh add example.txt ||exit 50
+[ -d /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 51
+[ -f /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 52
+
+$storesh rmall ||exit 60
+[ ! -d /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 61
+
+$storesh wipe store ||exit 70
+[ ! -d store ] ||exit 71
+
+echo TEST OK
+exit 0