src/server/test/webdav.h

branch
webdav
changeset 211
2160585200ac
child 213
4a6be4f10d5f
equal deleted inserted replaced
210:21274e5950af 211:2160585200ac
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2019 Olaf Wintermann. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef TEST_WEBDAV_H
30 #define TEST_WEBDAV_H
31
32 #include "../public/nsapi.h"
33 #include "../public/webdav.h"
34
35 #include <ucx/test.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 UCX_TEST(test_propfind_parse);
42 UCX_TEST(test_proppatch_parse);
43 UCX_TEST(test_lock_parse);
44
45 UCX_TEST(test_rqbody2buffer);
46
47 UCX_TEST(test_msresponse_addproperty);
48
49 /* --------------------------- PROPFIND --------------------------- */
50
51 #define TEST_PROPFIND1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
52 <D:propfind xmlns:D=\"DAV:\"> \
53 <D:prop> \
54 <D:displayname/> \
55 <D:getcontentlength/> \
56 <D:getcontenttype/> \
57 <D:getlastmodified/> \
58 <D:resourcetype/> \
59 <D:getetag/> \
60 </D:prop> \
61 </D:propfind>"
62
63 #define TEST_PROPFIND2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
64 <D:propfind xmlns:D=\"DAV:\"> \
65 <D:prop xmlns:X=\"http://example.com/\"> \
66 <D:resourcetype/> \
67 <X:testprop/> \
68 <X:name/> \
69 <Z:testprop xmlns:Z=\"testns\"/>\
70 </D:prop> \
71 </D:propfind>"
72
73 #define TEST_PROPFIND3 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
74 <D:propfind xmlns:D=\"DAV:\"> \
75 <D:allprop/> \
76 </D:propfind>"
77
78 #define TEST_PROPFIND4 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
79 <D:propfind xmlns:D=\"DAV:\"> \
80 <D:propname/> \
81 </D:propfind>"
82
83 #define TEST_PROPFIND5 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
84 <D:propfind xmlns:D=\"DAV:\"> \
85 <D:prop> \
86 <D:displayname/> \
87 <D:getcontentlength/> \
88 <D:getetag/> \
89 <D:getcontentlength/> \
90 <D:resourcetype/> \
91 </D:prop> \
92 </D:propfind>"
93
94 #define TEST_PROPFIND6 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
95 <D:propfind xmlns:D=\"DAV:\"> \
96 <D:prop> \
97 <D:displayname/> \
98 <D:getcontentlength/> \
99 <D:getetag/> \
100 <D:resourcetype/> \
101 </D:prop> \
102 <D:allprop/> \
103 </D:propfind>"
104
105 /* --------------------------- PROPPATCH --------------------------- */
106
107 #define TEST_PROPPATCH1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
108 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \
109 <D:set> \
110 <D:prop><X:test>test</X:test><D:creationdate>123</D:creationdate></D:prop> \
111 </D:set> \
112 </D:propertyupdate>"
113
114 #define TEST_PROPPATCH2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
115 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \
116 <D:set> \
117 <D:prop> \
118 <X:a>test</X:a> \
119 <X:b>15</X:b> \
120 <X:c> \
121 <X:name test='test1' abc='def'>User</X:name><X:mail>user@host</X:mail> \
122 </X:c> \
123 <X:d><X:name>Test</X:name></X:d> \
124 </D:prop> \
125 </D:set> \
126 <D:remove> \
127 <D:prop> \
128 <X:e/> \
129 </D:prop> \
130 </D:remove> \
131 </D:propertyupdate>"
132
133 /* --------------------------- LOCK --------------------------- */
134
135 #define TEST_LOCK1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
136 <D:lockinfo xmlns:D=\"DAV:\"> \
137 <D:lockscope><D:shared/></D:lockscope> \
138 <D:locktype>D:write/></D:locktype> \
139 <D:owner>User</D:owner> \
140 </D:lockinfo>"
141
142 #ifdef __cplusplus
143 }
144 #endif
145
146 #endif /* TEST_WEBDAV_H */
147

mercurial