diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-01-31 18:03:49 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-02-09 13:45:13 +0100 |
commit | 7a403c7f93ebaddcfd9f38c7d3ca1ac1014b23cf (patch) | |
tree | d85b465ecaf97a7694ae3492fb2782284c85bb6a /imag-store/tests/001-create_test.sh | |
parent | 10fa3e3dafd3b44623b863344e562e80209e53fb (diff) |
tests: Add imag-store tests
Diffstat (limited to 'imag-store/tests/001-create_test.sh')
-rw-r--r-- | imag-store/tests/001-create_test.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/imag-store/tests/001-create_test.sh b/imag-store/tests/001-create_test.sh new file mode 100644 index 00000000..b7d641b6 --- /dev/null +++ b/imag-store/tests/001-create_test.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +source $(dirname ${BASH_SOURCE[0]})/utils.sh + +test_call() { + imag-store create -p /test-call + if [[ ! $? -eq 0 ]]; then + err "Return value should be zero, was non-zero" + return 1; + fi +} + +test_mkstore() { + imag-store create -p /test-mkstore || { err "Calling imag failed"; return 1; } + if [[ -d ${STORE} ]]; then + out "Store exists." + else + err "No store created" + return 1 + fi +} + +test_std_header() { + local expected=$(cat <<EOS +--- +[imag] +links = [] +version = "0.1.0" +--- + +EOS +) + + imag-store create -p /test-std-header + local result=$(cat ${STORE}/test-std-header) + if [[ "$expected" == "$result" ]]; then + out "Expected store entry == result" + else + err "${STORE}/test differs from expected" + return 1 + fi +} + +invoke_tests \ + test_call \ + test_mkstore \ + test_std_header \ + test_std_header_plus_custom + |