Add STATUS_MODIFIED.
[pwmd.git] / tests / bulk.test
blob0b4090b57d33ef80deaae4f562250b7e8aea1f5f
1 #!/bin/sh
3 # Tests for the BULK protocol command.
5 MAX_TESTS=4
7 . $AM_SRCDIR/common.sh
8 . $AM_SRCDIR/import-common.sh
10 init_tests() {
11 do_import datafile
12 cat >$OUTDIR/config <<EOF
13 [global]
14 log_level=9
15 #enable_logging=true
16 invoking_user=$USER
17 [datafile]
18 passphrase_file=$WDIR/passphrase.key
19 [datafile.tmp]
20 passphrase_file=$WDIR/passphrase.key
21 EOF
22 launch_pwmd datafile
25 test_1() {
26 cp -f data/datafile data/datafile.tmp || bail_out "Could not copy data/datafile"
27 run_pwmc "--inquire 'BULK --inquire' datafile.tmp" $DEVNULL <<EOF
28 (2:id 1:1 7:getinfo7:vrsion)
29 EOF
30 test_failure $test_n $? 536870941 "Inquire syntax error"
33 test_2() {
34 cp -f data/datafile data/datafile.tmp || bail_out "Could not copy data/datafile"
35 run_pwmc "--inquire 'BULK --inquire' datafile.tmp" >result $DEVNULL <<EOF
36 (2:id 1:1 7:getinfo7:clients
37 2:rc 1:0
38 (2:id1:2 4:list5:--all
39 2:rc 1:0
40 (2:id1:3 3:get0:
41 2:rc 9:536870941
42 (2:id1:4 7:getinfo7:clients)
43 2:id1:5 7:getinfo5:cache))
44 2:id1:6 9:getconfig12:client-state
45 2:rc 9:536871086
46 (2:id1:1 4:list0:))
47 EOF
48 test_result $test_n $? bulk "Command branching"
51 test_3() {
52 cp -f data/datafile data/datafile.tmp || bail_out "Could not copy data/datafile"
53 run_pwmc "--inquire 'BULK --inquire' datafile.tmp" >result $DEVNULL <<EOF
54 (2:id 1:1 7:getinfo7:clients
55 2:rc 1:0
56 (2:id1:2 4:list5:--all
57 2:rc 1:0
58 (2:id1:3 3:get3:a b
59 2:rc 9:536870941
60 (2:id1:4 3:nop0:)
61 2:rc 1:0
62 (2:id1:5 7:getinfo14:--data clients))
63 2:id1:6 9:getconfig3:nop
64 2:rc 9:536871086
65 (2:id1:7 4:list0:))
66 2:id1:8 7:getinfo 3:nop)
67 EOF
68 test_result $test_n $? bulk "Command branching (next rc)"
71 test_4() {
72 cp -f data/datafile data/datafile.tmp || bail_out "Could not copy data/datafile"
73 run_pwmc "--inquire 'BULK --inquire' datafile.tmp" >result $DEVNULL <<EOF
74 (2:id 1:1 7:getinfo7:clients
75 2:rc 11:12345|67890
76 (2:id1:2 4:list5:--all
77 2:rc 1:0
78 (2:id1:3 3:get3:a b
79 2:rc 9:536870941
80 (2:id1:4 3:nop0:)
81 2:rc 1:0
82 (2:id1:5 7:getinfo14:--data clients))
83 2:id1:6 9:getconfig3:nop
84 2:rc 9:536871086
85 (2:id1:7 4:list0:))
86 2:rc 1:0
87 (2:id1:8 7:getinfo 3:nop))
88 EOF
89 test_result $test_n $? bulk "Command branching (multiple rc's)"
92 run_tests $@