#!/usr/bin/env bash
. ./wvtest-bup.sh || exit $?

set -o pipefail

top="$(WVPASS pwd)" || exit $?
tmpdir="$(WVPASS wvmktempdir)" || exit $?

export BUP_DIR="$tmpdir/bup"
export GIT_DIR="$tmpdir/bup"

bup() { "$top/bup" "$@"; }

if ! [ "$(type -p duplicity)" != "" ]; then
    # FIXME: add WVSKIP.
    echo "Cannot find duplicity; skipping test)" 1>&2
    exit 0
fi

export PASSPHRASE=bup_duplicity_passphrase
D=duplicity.tmp
WVSTART "import-duplicity"
WVPASS bup init
WVPASS cd "$tmpdir"
WVPASS mkdir duplicity
WVPASS duplicity "$top/Documentation" "file://duplicity"
WVPASS bup tick
WVPASS duplicity "$top/Documentation" "file://duplicity"
WVPASS bup import-duplicity "file://duplicity" import-duplicity
WVPASSEQ "$(bup ls import-duplicity/ | wc -l)" "3"
WVPASSEQ "$(bup ls import-duplicity/latest/ | sort)" "$(ls $top/Documentation | sort)"

WVPASS rm -rf "$tmpdir"

Add a testcase for the import-duplicity command
Add a testcase for the import-duplicity command

Signed-off-by: Zoran Zaric <d7dacae2c968388960bf8970080a980ed5c5dcb7@zoranzaric.de>
[1dc5917c2adeeba13d1ef33dbb40691a1b67cc65@defaultvalue.org: adjust commit message; update tests during rebase
 and move them from test.sh to t/test-import-duplicity.sh following
 break-up of test.sh.]
Signed-off-by: Rob Browning <1dc5917c2adeeba13d1ef33dbb40691a1b67cc65@defaultvalue.org>
