3 # Tests for the IMPORT protocol command.
8 .
$AM_SRCDIR/import-common.sh
12 cat >$OUTDIR/config
<< EOF
18 passphrase_file=$WDIR/passphrase.key
20 mv -f data
/list data
/import || bail_out
"Could not move data/list."
25 run_pwmc
"--inquire IMPORT import" $DEVNULL <<EOF
26 <element _name="import">import value</invalid>
28 test_failure
$test_n $?
536871001 "Invalid syntax."
32 run_pwmc
"--inquire IMPORT import -S" $DEVNULL <<EOF
33 <element _name="import">import value</element>
37 run_pwmc
"import" >result
$DEVNULL <<EOF
42 test_result
$test_n $e import
"Import to root."
46 run_pwmc
"--inquire IMPORT import -S" $DEVNULL <<EOF
47 <element _name="import">new import value</element>
51 run_pwmc
"import" >result
$DEVNULL <<EOF
56 test_result
$test_n $e import
"Import to root with overwrite."
60 run_pwmc
"--inquire 'IMPORT --root=import' import -S" $DEVNULL <<EOF
61 <element _name="child">child import value</element>
65 run_pwmc
"import" >result
$DEVNULL <<EOF
70 test_result
$test_n $e import
"Import to child."
74 run_pwmc
"--inquire 'IMPORT --root=import' import -S" $DEVNULL <<EOF
75 <element _name="child">new child import value</element>
79 run_pwmc
"import" >result
$DEVNULL <<EOF
84 test_result
$test_n $e import
"Import to child with overwrite."
88 run_pwmc
"--inquire 'IMPORT --root=import\troot' import -S" $DEVNULL <<EOF
89 <element _name="a">A value<element _name="b">A B value</element></element>
90 <element _name="b">B value</element>
94 run_pwmc
"import" >result
$DEVNULL <<EOF
99 test_result
$test_n $e import
"Import siblings."
103 run_pwmc
"--inquire 'IMPORT --root=import\troot' import -S" $DEVNULL <<EOF
104 <element _name="a">A value<element _name="b"/></element>
105 <element _name="b">B value</element>
108 if [ $e -eq 0 ]; then
109 run_pwmc
"import" >result
$DEVNULL <<EOF
114 test_result
$test_n $e import
"Import siblings with overwrite."
117 # FIXME what is this supposed to do?
119 run_pwmc
"import" >result
$DEVNULL <<EOF
122 test_failure
$test_n $?
536870970 "Fail to import siblings."