LIST: Fix memory leaks.
[pwmd.git] / tests / move.test
blobf8a8a43a68cb270760a4a1668b3767b5f1024103
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 [move]
17 passphrase_file=$WDIR/passphrase.key
18 EOF
19 mv -f data/list data/move || bail_out "Could not move data/list."
20 launch_pwmd move
23 test_1() {
24 run_pwmc "move" $DEVNULL <<EOF
25 MOVE a a
26 EOF
27 test_failure $test_n $? 536903715 "Fail to move src to src."
30 test_2() {
31 run_pwmc "move" $DEVNULL <<EOF
32 MOVE non-existant a
33 EOF
34 test_failure $test_n $? 536871048 "Fail to move non-existent element."
37 test_3() {
38 run_pwmc "move" $DEVNULL <<EOF
39 MOVE a b c
40 EOF
41 test_failure $test_n $? 536903715 "Fail to move child with target to root of same node."
44 test_4() {
45 run_pwmc "-S move" $DEVNULL <<EOF
46 MOVE a c a b c d e
47 EOF
48 list_recurse move
49 test_result $test_n $? move "Move child to sibling child with target."
52 test_5() {
53 run_pwmc "-S move" $DEVNULL <<EOF
54 MOVE a b c d e c a
55 EOF
56 list_recurse move
57 test_result $test_n $? move "Move child with target to parent sibling."
60 test_6() {
61 run_pwmc "-S move" $DEVNULL <<EOF
62 MOVE a b c d
63 EOF
64 list_recurse move
65 test_result $test_n $? move "Overwrite existing root tree."
68 test_7() {
69 run_pwmc "-S move" $DEVNULL <<EOF
70 MOVE d c e
71 EOF
72 list_recurse move
73 test_result $test_n $? move "Show child elements whose target contains an error."
76 test_8() {
77 run_pwmc "-S move" $DEVNULL <<EOF
78 MOVE x z
79 EOF
80 list_recurse move
81 test_result $test_n $? move "Move node whose target value is a document root node."
84 test_9() {
85 run_pwmc "-S move" $DEVNULL <<EOF
86 MOVE z x y z
87 EOF
88 list_recurse move
89 test_result $test_n $? move "Move node whose target value is a parent."
92 test_10() {
93 run_pwmc "-S move" $DEVNULL <<EOF
94 MOVE a c c f
95 EOF
96 list_recurse move
97 test_result $test_n $? move "Create new path from non-existing dest."
100 run_tests $@