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

Sun, 17 Jun 2018 07:11:31 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 17 Jun 2018 07:11:31 +0200
changeset 421
178dc32c8c9a
child 422
1429fb385513
permissions
-rwxr-xr-x

adds user+pw to repo-url output

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
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 # test
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 echo "hello world" > hello
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 dav put dav-test-repo/tests/ hello
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 DAV_RES=$?
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 rm hello
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 if [ $DAV_RES -ne 0 ]; then
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 echo "dav put returned" $DAV_RES
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 exit 2
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 fi
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 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
50 if [ $? -ne 0 ]; then
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 echo "dav info failed"
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 exit 2
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 fi
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 echo $OUT | grep "type: resource" > /dev/null
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 if [ $? -ne 0 ];
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 then
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 echo "wrong resource type"
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 exit 2
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 fi
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61
178dc32c8c9a adds user+pw to repo-url output
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62

mercurial