3 source import-common.sh
12 passphrase_file=`pwd`/passphrase.key
16 mv -f data
/list data
/import
20 test_header
"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 test_header
"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 test_header
"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 test_header
"Test 4. Import to child."
52 cat << EOF | tr -d '\n' | pwmc $PWMC_ARGS --inquire "IMPORT --root=import" import -S
53 <element _name="child">child import value</element>
55 echo -ne 'GET import\tchild' | pwmc
$PWMC_ARGS import
> result
56 cmp import.result4 result
60 test_header
"Test 5. Import to child (overwrite)."
61 cat << EOF | tr -d '\n' | pwmc $PWMC_ARGS --inquire "IMPORT --root=import" import -S
62 <element _name="child">new child import value</element>
64 echo -ne 'GET import\tchild' | pwmc
$PWMC_ARGS import
> result
65 cmp import.result5 result
69 test_header
"Test 6. Import siblings."
70 cat << EOF | tr -d '\n' | pwmc $PWMC_ARGS --inquire "IMPORT --root=import\troot" import -S
71 <element _name="a">A value<element _name="b">A B value</element></element>
72 <element _name="b">B value</element>
74 echo -ne 'GET import\troot\ta\tb' | pwmc
$PWMC_ARGS import
> result
75 cmp import.result6 result
79 test_header
"Test 7. Import siblings (overwrite)."
80 cat << EOF | tr -d '\n' | pwmc $PWMC_ARGS --inquire "IMPORT --root=import\troot" import -S
81 <element _name="a">A value<element _name="b"/></element>
82 <element _name="b">B value</element>
84 echo -ne 'GET import\troot\tb' | pwmc
$PWMC_ARGS import
> result
85 cmp import.result7 result
89 test_header
"Test 8. Import siblings (fail)."
91 echo -ne 'GET import\troot\ta\tb' | pwmc
$PWMC_ARGS import
> result
93 if [ ${PIPESTATUS[1]} == 0 ]; then
94 echo "The previous command should have failed. Stopping."