ATTR LIST: No non-reserved attributes for bad permissions.
[pwmd.git] / tests / xpath.test
blob556975d501cb9437beb460352df3bf7c0fc9a54e
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 [xpath]
12 passphrase_file=`pwd`/passphrase.key
13 EOF
15 set -e
16 mv -f data/list data/xpath
17 launch_pwmd xpath
19 begin_test
20 test_header "Test 1. XPATH no matching elements (fail)."
21 set +o errexit
22 echo -ne 'XPATH /element' | pwmc $PWMC_ARGS xpath
23 if [ ${PIPESTATUS[1]} == 0 ]; then
24 echo "The previous command should have failed. Stopping."
25 exit 1
28 set -e
30 echo
31 test_header "Test 2. XPATH invalid expression syntax (fail)."
32 set +o errexit
33 echo -ne 'XPATH /element[]' | pwmc $PWMC_ARGS xpath
34 if [ ${PIPESTATUS[1]} == 0 ]; then
35 echo "The previous command should have failed. Stopping."
36 exit 1
39 set -e
41 echo
42 test_header "Test 3. Retrieve expression."
43 echo -ne 'XPATH //element[@_name="a"]' | pwmc $PWMC_ARGS xpath > result
44 cmp xpath.result3 result
45 rm -f result
47 echo
48 test_header "Test 4. Set expression value."
49 echo -ne 'XPATH /pwmd/element[@_name="a"]\tnew value' | pwmc $PWMC_ARGS -S xpath
50 echo -ne 'LIST --recurse' | pwmc $PWMC_ARGS xpath > result
51 cmp xpath.result4 result
52 rm -f result
54 test_success