test/bin-test/test-dav-put.sh

Sun, 17 Sep 2023 11:21:31 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 17 Sep 2023 11:21:31 +0200
changeset 790
7110b37f2a6b
parent 422
1429fb385513
permissions
-rwxr-xr-x

fix dav_context_destroy

421
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 # Copyright 2018 Olaf Wintermann. All rights reserved.
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 # Redistribution and use in source and binary forms, with or without
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 # modification, are permitted provided that the following conditions are met:
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 #
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 # 1. Redistributions of source code must retain the above copyright
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 # notice, this list of conditions and the following disclaimer.
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 #
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 # 2. Redistributions in binary form must reproduce the above copyright
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 # notice, this list of conditions and the following disclaimer in the
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 # documentation and/or other materials provided with the distribution.
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 # POSSIBILITY OF SUCH DAMAGE.
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 #
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 if [ -z "$DAV_BIN" ];
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 then
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 echo "DAV_BIN variable not set"
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 exit 1
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 fi
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 BASE_URL=`dav repo-url dav-test-repo`
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37
422
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
38 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
39 # test simple file upload
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
40 #
421
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 echo "hello world" > hello
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 dav put dav-test-repo/tests/ hello
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 DAV_RES=$?
422
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
44 rm -f hello
421
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 if [ $DAV_RES -ne 0 ]; then
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 echo "dav put returned" $DAV_RES
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 exit 2
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 fi
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 OUT=`dav info dav-test-repo/tests/hello`
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 if [ $? -ne 0 ]; then
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 echo "dav info failed"
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 exit 2
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 fi
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 echo $OUT | grep "type: resource" > /dev/null
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 if [ $? -ne 0 ];
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 then
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 echo "wrong resource type"
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 exit 2
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 fi
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63
422
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
64 echo "hello world" > hello
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
65 curl --silent -o cmphello $BASE_URL/tests/hello
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
66 diff hello cmphello > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
67 RES=$?
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
68 rm -f hello
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
69 rm -f cmphello
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
70 if [ $RES -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
71 echo "wrong content"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
72 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
73 fi
421
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74
422
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
75 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
76 # test dir upload
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
77 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
78 dav put -R dav-test-repo/tests/ testdir > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
79 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
80 echo "dir upload failed"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
81 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
82 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
83
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
84 # check file1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
85 curl --silent -o tmp_file1 $BASE_URL/tests/file1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
86 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
87 echo "cannot download file1"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
88 rm -f tmp_file1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
89 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
90 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
91
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
92 diff testdir/file1 tmp_file1 > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
93 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
94 echo "file1 has wrong content"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
95 rm -f tmp_file1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
96 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
97 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
98 rm tmp_file1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
99
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
100 # check subdir file
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
101 curl --silent -o tmp_sub1 $BASE_URL/tests/subdir/sub1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
102 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
103 echo "cannot download subdir/sub1"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
104 rm tmp_sub1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
105 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
106 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
107
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
108 diff testdir/subdir/sub1 tmp_sub1 > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
109 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
110 echo "subdir/sub1 has wrong content"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
111 rm -f tmp_sub1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
112 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
113 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
114 rm -f tmp_sub1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
115
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
116 # check subdir
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
117 OUT=`dav info dav-test-repo/tests/subdir`
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
118 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
119 echo "cannot get subdir infos"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
120 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
121 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
122
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
123 echo $OUT | grep "type: collection" > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
124 if [ $? -ne 0 ];
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
125 then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
126 echo "subdir has wrong type"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
127 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
128 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
129
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
130 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
131 # test upload to specific url
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
132 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
133 dav put dav-test-repo/tests/uploaded_file testdir/file1
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
134 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
135 echo "upload to /tests/uploaded_file failed"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
136 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
137 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
138 curl --silent -o /dev/null $BASE_URL/tests/uploaded_file
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
139 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
140 echo "uploaded_file has wrong content"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
141 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
142 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
143
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
144 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
145 # test upload with automatic collection creation
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
146 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
147 dav put dav-test-repo/tests/newdir/newsubdir/newfile testdir/file2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
148 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
149 echo "upload to /tests/newdir/newsubdir/newfile failed"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
150 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
151 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
152 curl --silent -o /dev/null $BASE_URL/tests/newdir/newsubdir/newfile
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
153 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
154 echo "newfile has wrong content"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
155 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
156 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
157
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
158 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
159 # test dir upload to specific url
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
160 #
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
161 dav put -R dav-test-repo/tests/testdir testdir > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
162 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
163 echo "dir upload to /tests/testdir failed"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
164 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
165 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
166
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
167 OUT=`dav info dav-test-repo/tests/testdir`
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
168 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
169 echo "cannot get /tests/testdir infos"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
170 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
171 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
172
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
173 echo $OUT | grep "type: collection" > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
174 if [ $? -ne 0 ];
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
175 then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
176 echo "/tests/testdir has wrong type"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
177 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
178 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
179
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
180 curl --silent -o tmp_file3 $BASE_URL/tests/testdir/file3
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
181 CURL_RES=$?
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
182 diff tmp_file3 testdir/file3 > /dev/null
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
183 DIFF_RES=$?
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
184 rm -f tmp_file3
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
185
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
186 if [ $CURL_RES -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
187 echo "cannot download /tests/testdir/file3"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
188 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
189 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
190 if [ $DIFF_RES -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
191 echo "/tests/testdir/file3 has wrong content"
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
192 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
193 fi

mercurial