docs: Update to add LIST --sexp.
[pwmd.git] / tests / xpath.test
blob2e19da5a9fe85307450441d6818000fcb00f79ae
1 #!/bin/sh
3 # Tests for the XPATH protocol command.
5 MAX_TESTS=4
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 [xpath]
17 passphrase_file=$WDIR/passphrase.key
18 EOF
19 mv -f data/list data/xpath || bail_out "Could not move data/list."
20 launch_pwmd xpath
23 test_1() {
24 run_pwmc "xpath" $DEVNULL <<EOF
25 XPATH /element
26 EOF
27 test_failure $test_n $? 536871048 "Fail due to no matching elements."
30 test_2() {
31 run_pwmc "xpath" $DEVNULL <<EOF
32 XPATH /element[]
33 EOF
34 test_failure $test_n $? 536871001 "Fail due to invalid expression syntax."
37 test_3() {
38 run_pwmc "xpath" >result $DEVNULL <<EOF
39 XPATH //element[@_name="a"]
40 EOF
41 test_result $test_n $? xpath "Expression result."
44 test_4() {
45 run_pwmc "-S xpath" $DEVNULL <<EOF
46 XPATH /pwmd/element[@_name="a"] new value
47 EOF
48 list_recurse xpath
49 test_result $test_n $? xpath "Setting of element content."
52 run_tests $@