|
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 "testutils.h" |
|
36 |
|
37 #include <ucx/test.h> |
|
38 |
|
39 #ifdef __cplusplus |
|
40 extern "C" { |
|
41 #endif |
|
42 |
|
43 void init_test_webdav_method( |
|
44 Session **out_sn, |
|
45 Request **out_rq, |
|
46 TestIOStream **out_st, |
|
47 pblock **out_pb, |
|
48 const char *method, |
|
49 const char *path, |
|
50 const char *request_body); |
|
51 |
|
52 UCX_TEST(test_webdav_plist_add); |
|
53 UCX_TEST(test_webdav_plist_size); |
|
54 |
|
55 UCX_TEST(test_propfind_parse); |
|
56 UCX_TEST(test_proppatch_parse); |
|
57 UCX_TEST(test_lock_parse); |
|
58 |
|
59 UCX_TEST(test_rqbody2buffer); |
|
60 |
|
61 UCX_TEST(test_webdav_plist_iterator); |
|
62 UCX_TEST(test_webdav_plist_iterator_remove_current); |
|
63 |
|
64 UCX_TEST(test_msresponse_addproperty); |
|
65 UCX_TEST(test_msresponse_addproperty_with_errors); |
|
66 |
|
67 UCX_TEST(test_webdav_propfind_init); |
|
68 UCX_TEST(test_webdav_op_propfind_begin); |
|
69 UCX_TEST(test_webdav_op_propfind_children); |
|
70 |
|
71 UCX_TEST(test_webdav_propfind); |
|
72 |
|
73 UCX_TEST(test_proppatch_msresponse); |
|
74 UCX_TEST(test_webdav_op_proppatch); |
|
75 |
|
76 UCX_TEST(test_webdav_proppatch); |
|
77 |
|
78 UCX_TEST(test_webdav_vfs_op_do); |
|
79 |
|
80 UCX_TEST(test_webdav_delete); |
|
81 UCX_TEST(test_webdav_put); |
|
82 |
|
83 /* --------------------------- PROPFIND --------------------------- */ |
|
84 |
|
85 #define TEST_PROPFIND1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
86 <D:propfind xmlns:D=\"DAV:\"> \ |
|
87 <D:prop> \ |
|
88 <D:displayname/> \ |
|
89 <D:getcontentlength/> \ |
|
90 <D:getcontenttype/> \ |
|
91 <D:getlastmodified/> \ |
|
92 <D:resourcetype/> \ |
|
93 <D:getetag/> \ |
|
94 </D:prop> \ |
|
95 </D:propfind>" |
|
96 |
|
97 #define TEST_PROPFIND2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
98 <D:propfind xmlns:D=\"DAV:\"> \ |
|
99 <D:prop xmlns:X=\"http://example.com/\"> \ |
|
100 <D:resourcetype/> \ |
|
101 <X:testprop/> \ |
|
102 <X:name/> \ |
|
103 <Z:testprop xmlns:Z=\"testns\"/>\ |
|
104 </D:prop> \ |
|
105 </D:propfind>" |
|
106 |
|
107 #define TEST_PROPFIND3 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
108 <D:propfind xmlns:D=\"DAV:\"> \ |
|
109 <D:allprop/> \ |
|
110 </D:propfind>" |
|
111 |
|
112 #define TEST_PROPFIND4 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
113 <D:propfind xmlns:D=\"DAV:\"> \ |
|
114 <D:propname/> \ |
|
115 </D:propfind>" |
|
116 |
|
117 #define TEST_PROPFIND5 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
118 <D:propfind xmlns:D=\"DAV:\"> \ |
|
119 <D:prop> \ |
|
120 <D:displayname/> \ |
|
121 <D:getcontentlength/> \ |
|
122 <D:getetag/> \ |
|
123 <D:getcontentlength/> \ |
|
124 <D:resourcetype/> \ |
|
125 </D:prop> \ |
|
126 </D:propfind>" |
|
127 |
|
128 #define TEST_PROPFIND6 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
129 <D:propfind xmlns:D=\"DAV:\"> \ |
|
130 <D:prop> \ |
|
131 <D:displayname/> \ |
|
132 <D:getcontentlength/> \ |
|
133 <D:getetag/> \ |
|
134 <D:resourcetype/> \ |
|
135 </D:prop> \ |
|
136 <D:allprop/> \ |
|
137 </D:propfind>" |
|
138 |
|
139 /* --------------------------- PROPPATCH --------------------------- */ |
|
140 |
|
141 #define TEST_PROPPATCH1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
142 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \ |
|
143 <D:set> \ |
|
144 <D:prop><X:test>test</X:test><D:creationdate>123</D:creationdate></D:prop> \ |
|
145 </D:set> \ |
|
146 </D:propertyupdate>" |
|
147 |
|
148 #define TEST_PROPPATCH2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
149 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \ |
|
150 <D:set> \ |
|
151 <D:prop> \ |
|
152 <X:a>test</X:a> \ |
|
153 <X:b>15</X:b> \ |
|
154 <X:c> \ |
|
155 <X:name test='test1' abc='def'>User</X:name><X:mail>user@host</X:mail> \ |
|
156 </X:c> \ |
|
157 <X:d><X:name>Test</X:name></X:d> \ |
|
158 </D:prop> \ |
|
159 </D:set> \ |
|
160 <D:remove> \ |
|
161 <D:prop> \ |
|
162 <X:e/> \ |
|
163 </D:prop> \ |
|
164 </D:remove> \ |
|
165 </D:propertyupdate>" |
|
166 |
|
167 #define TEST_PROPPATCH3 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
168 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \ |
|
169 <D:set> \ |
|
170 <D:prop> \ |
|
171 <X:a>test</X:a> \ |
|
172 <X:fail>15</X:fail> \ |
|
173 </D:prop> \ |
|
174 </D:set> \ |
|
175 <D:remove> \ |
|
176 <D:prop> \ |
|
177 <X:e/> \ |
|
178 </D:prop> \ |
|
179 </D:remove> \ |
|
180 </D:propertyupdate>" |
|
181 |
|
182 #define TEST_PROPPATCH4 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
183 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \ |
|
184 <D:set> \ |
|
185 <D:prop><X:abort>error</X:abort></D:prop> \ |
|
186 </D:set> \ |
|
187 </D:propertyupdate>" |
|
188 |
|
189 /* --------------------------- LOCK --------------------------- */ |
|
190 |
|
191 #define TEST_LOCK1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \ |
|
192 <D:lockinfo xmlns:D=\"DAV:\"> \ |
|
193 <D:lockscope><D:shared/></D:lockscope> \ |
|
194 <D:locktype>D:write/></D:locktype> \ |
|
195 <D:owner>User</D:owner> \ |
|
196 </D:lockinfo>" |
|
197 |
|
198 #ifdef __cplusplus |
|
199 } |
|
200 #endif |
|
201 |
|
202 #endif /* TEST_WEBDAV_H */ |
|
203 |