Fix compile time warning.
[pwmd.git] / tests / import.test
blob1140916e653c5ac788c54d0b87de433a26452fed
1 #!/bin/bash
2 source common.sh
3 source import-common.sh
5 do_import list
7 cat > config << EOF
8 [global]
9 log_level=9
10 #enable_logging=true
11 [import]
12 passphrase_file=`pwd`/list.key
13 EOF
15 set -e
16 mv -f data/list data/import
17 launch_pwmd import
19 begin_test
20 echo "Test 1. Import invalid syntax (fail)."
21 set +o errexit
22 cat << EOF | pwmc $PWMC_ARGS --inquire IMPORT import
23 <element _name="import">import value</invalid>
24 EOF
25 if [ ${PIPESTATUS[1]} == 0 ]; then
26 echo "The previous command should have failed. Stopping."
27 exit 1
30 set -e
32 echo
33 echo "Test 2. Import to root."
34 cat << EOF | pwmc $PWMC_ARGS --inquire IMPORT import -S
35 <element _name="import">import value</element>
36 EOF
37 echo -ne 'GET import' | pwmc $PWMC_ARGS import > result
38 cmp import.result2 result
39 rm -f result
41 echo
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>
45 EOF
46 echo -ne 'GET import' | pwmc $PWMC_ARGS import > result
47 cmp import.result3 result
48 rm -f result
50 echo
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
54 EOF
55 echo -ne 'GET import\tchild' | pwmc $PWMC_ARGS import > result
56 cmp import.result4 result
57 rm -f result
59 echo
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
63 EOF
64 echo -ne 'GET import\tchild' | pwmc $PWMC_ARGS import > result
65 cmp import.result5 result
66 rm -f result
68 test_success