tests: Fix to specify invoking_user.
[pwmd.git] / tests / move.test
blobd5afe861ffc8a62e190f3db9194fe72c60cf399d
1 #!/bin/sh
3 # Tests for the MOVE protocol command.
5 MAX_TESTS=10
7 . $AM_SRCDIR/common.sh
8 . $AM_SRCDIR/import-common.sh
10 init_tests() {
11 do_import list
12 cat >$OUTDIR/config << EOF
13 [global]
14 log_level=9
15 #enable_logging=true
16 invoking_user=$USER
17 [move]
18 passphrase_file=$WDIR/passphrase.key
19 EOF
20 mv -f data/list data/move || bail_out "Could not move data/list."
21 launch_pwmd move
24 test_1() {
25 run_pwmc "move" $DEVNULL <<EOF
26 MOVE a a
27 EOF
28 test_failure $test_n $? 536903715 "Fail to move src to src."
31 test_2() {
32 run_pwmc "move" $DEVNULL <<EOF
33 MOVE non-existant a
34 EOF
35 test_failure $test_n $? 536871048 "Fail to move non-existent element."
38 test_3() {
39 run_pwmc "move" $DEVNULL <<EOF
40 MOVE a b c
41 EOF
42 test_failure $test_n $? 536903715 "Fail to move child with target to root of same node."
45 test_4() {
46 run_pwmc "-S move" $DEVNULL <<EOF
47 MOVE a c a b c d e
48 EOF
49 list_recurse move
50 test_result $test_n $? move "Move child to sibling child with target."
53 test_5() {
54 run_pwmc "-S move" $DEVNULL <<EOF
55 MOVE a b c d e c a
56 EOF
57 list_recurse move
58 test_result $test_n $? move "Move child with target to parent sibling."
61 test_6() {
62 run_pwmc "-S move" $DEVNULL <<EOF
63 MOVE a b c d
64 EOF
65 list_recurse move
66 test_result $test_n $? move "Overwrite existing root tree."
69 test_7() {
70 run_pwmc "-S move" $DEVNULL <<EOF
71 MOVE d c e
72 EOF
73 list_recurse move
74 test_result $test_n $? move "Show child elements whose target contains an error."
77 test_8() {
78 run_pwmc "-S move" $DEVNULL <<EOF
79 MOVE x z
80 EOF
81 list_recurse move
82 test_result $test_n $? move "Move node whose target value is a document root node."
85 test_9() {
86 run_pwmc "-S move" $DEVNULL <<EOF
87 MOVE z x y z
88 EOF
89 list_recurse move
90 test_result $test_n $? move "Move node whose target value is a parent."
93 test_10() {
94 run_pwmc "-S move" $DEVNULL <<EOF
95 MOVE a c c f
96 EOF
97 list_recurse move
98 test_result $test_n $? move "Create new path from non-existing dest."
101 run_tests $@