3 source import-common.sh
12 passphrase_file=`pwd`/list.key
16 mv -f data
/list data
/import
20 echo "Test 1. Import invalid syntax (fail)."
22 cat << EOF | pwmc $PWMC_ARGS --inquire IMPORT import
23 <element _name="import">import value</invalid>
25 if [ ${PIPESTATUS[1]} == 0 ]; then
26 echo "The previous command should have failed. Stopping."
33 echo "Test 2. Import to root."
34 cat << EOF | pwmc $PWMC_ARGS --inquire IMPORT import -S
35 <element _name="import">import value</element>
37 echo -ne 'GET import' | pwmc
$PWMC_ARGS import
> result
38 cmp import.result2 result
42 echo "Test 3. Import to root (overwrite)."
43 cat << EOF | pwmc $PWMC_ARGS --inquire IMPORT import -S
44 <element _name="import">new import value</element>
46 echo -ne 'GET import' | pwmc
$PWMC_ARGS import
> result
47 cmp import.result3 result
51 echo "Test 4. Import to child."
52 cat << EOF | tr -d '\n' | pwmc $PWMC_ARGS --inquire IMPORT import -S
53 <element _name="child">child import value</element> import
55 echo -ne 'GET import\tchild' | pwmc
$PWMC_ARGS import
> result
56 cmp import.result4 result
60 echo "Test 5. Import to child (overwrite)."
61 cat << EOF | tr -d '\n' | pwmc $PWMC_ARGS --inquire IMPORT import -S
62 <element _name="child">new child import value</element> import
64 echo -ne 'GET import\tchild' | pwmc
$PWMC_ARGS import
> result
65 cmp import.result5 result