Tue, 31 Dec 2019 10:01:32 +0100
add backend chaining
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2019 Olaf Wintermann. All rights reserved. |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include <stdio.h> |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #include <stdlib.h> |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include <string.h> |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "testutils.h" |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | #include "../webdav/requestparser.h" |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #include "../webdav/webdav.h" |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | #include "../webdav/multistatus.h" |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | #include "webdav.h" |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | |
217
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
41 | /* ----------------------------- Test Backends --------------------------*/ |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
42 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
43 | // backend2 |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
44 | static int backend2_propfind_init( |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
45 | WebdavPropfindRequest *propfind, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
46 | const char *path, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
47 | WebdavPList **outPList) |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
48 | { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
49 | return 0; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
50 | } |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
51 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
52 | static int backend2_propfind_do( |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
53 | WebdavPropfindRequest *propfind, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
54 | WebdavResponse *response, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
55 | VFS_DIR parent, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
56 | WebdavResource *resource, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
57 | struct stat *s) |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
58 | { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
59 | return 0; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
60 | } |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
61 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
62 | static int backend2_propfind_finish(WebdavPropfindRequest *propfind) { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
63 | return 0; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
64 | } |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
65 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
66 | static WebdavBackend backend2 = { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
67 | backend2_propfind_init, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
68 | backend2_propfind_do, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
69 | backend2_propfind_finish, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
70 | 0, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
71 | NULL |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
72 | }; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
73 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
74 | // backend1 |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
75 | static int backend1_propfind_init( |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
76 | WebdavPropfindRequest *propfind, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
77 | const char *path, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
78 | WebdavPList **outPList) |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
79 | { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
80 | WebdavPList *plist = *outPList; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
81 | WebdavProperty *p = plist->property; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
82 | if(!strcmp(p->name, "displayname")) { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
83 | plist->next->prev = NULL; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
84 | *outPList = plist->next; // remove first item from plist |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
85 | } else { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
86 | return 1; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
87 | } |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
88 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
89 | return 0; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
90 | } |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
91 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
92 | static int backend1_propfind_do( |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
93 | WebdavPropfindRequest *propfind, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
94 | WebdavResponse *response, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
95 | VFS_DIR parent, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
96 | WebdavResource *resource, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
97 | struct stat *s) |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
98 | { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
99 | return 0; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
100 | } |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
101 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
102 | static int backend1_propfind_finish(WebdavPropfindRequest *propfind) { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
103 | return 0; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
104 | } |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
105 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
106 | WebdavBackend backend1 = { |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
107 | backend1_propfind_init, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
108 | backend1_propfind_do, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
109 | backend1_propfind_finish, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
110 | 0, |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
111 | &backend2 |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
112 | }; |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
113 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
114 | /* ----------------------------------------------------------------------*/ |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
115 | |
8ed14d76db42
add backend chaining
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
216
diff
changeset
|
116 | |
215
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
117 | static int test_init( |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
118 | Session **out_sn, |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
119 | Request **out_rq, |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
120 | WebdavPropfindRequest **out_propfind, |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
121 | const char *xml) |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
122 | { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
123 | Session *sn = testutil_session(); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
124 | Request *rq = testutil_request(sn->pool, "PROPFIND", "/"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
125 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
126 | int error = 0; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
127 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
128 | WebdavPropfindRequest *propfind = propfind_parse( |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
129 | sn, |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
130 | rq, |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
131 | xml, |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
132 | strlen(xml), |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
133 | &error); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
134 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
135 | if(error) { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
136 | return 1; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
137 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
138 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
139 | if(!propfind || !propfind->properties) { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
140 | return 1; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
141 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
142 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
143 | *out_sn = sn; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
144 | *out_rq = rq; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
145 | *out_propfind = propfind; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
146 | return 0; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
147 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
148 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
149 | |
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | UCX_TEST(test_propfind_parse) { |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | Session *sn = testutil_session(); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | Request *rq = testutil_request(sn->pool, "PROPFIND", "/"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | UCX_TEST_BEGIN |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | int error = 0; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | // ----------------- TEST_PROPFIND1 ----------------- |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | // test basic propfind request |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | WebdavPropfindRequest *p1 = propfind_parse( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | sn, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | rq, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | TEST_PROPFIND1, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
165 | strlen(TEST_PROPFIND1), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166 | &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
168 | UCX_TEST_ASSERT(p1, "p1 is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
169 | UCX_TEST_ASSERT(p1->properties, "p1: no props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
170 | UCX_TEST_ASSERT(!p1->allprop, "p1: allprop is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
171 | UCX_TEST_ASSERT(!p1->propname, "p1: propname is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
172 | UCX_TEST_ASSERT(p1->propcount == 6, "p1: wrong propcount"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
173 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
174 | // property 1: DAV:displayname |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
175 | WebdavPList *elm = p1->properties; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
176 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
177 | !strcmp(elm->property->name, "displayname"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
178 | "p1: property 1 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
179 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
180 | !strcmp((char*)elm->property->namespace->href, "DAV:"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
181 | "p1: property 1 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
182 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
183 | // property 2: DAV:getcontentlength |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
184 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
185 | UCX_TEST_ASSERT(elm, "p1: property 2 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
186 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
187 | !strcmp(elm->property->name, "getcontentlength"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
188 | "p1: property 2 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
189 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
190 | !strcmp((char*)elm->property->namespace->href, "DAV:"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
191 | "p1: property 2 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
192 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
193 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
194 | UCX_TEST_ASSERT(elm, "p1: property 3 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
195 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
196 | UCX_TEST_ASSERT(elm, "p1: property 4 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
197 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
198 | UCX_TEST_ASSERT(elm, "p1: property 5 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
199 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
200 | // property 6: DAV:getetag |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
201 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
202 | UCX_TEST_ASSERT(elm, "p1: property 6 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
203 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
204 | !strcmp(elm->property->name, "getetag"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
205 | "p1: property 6 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
206 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
207 | !strcmp((char*)elm->property->namespace->href, "DAV:"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
208 | "p1: property 6 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
209 | UCX_TEST_ASSERT(!elm->next, "p1: should not have property 7"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
210 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
211 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
212 | // ----------------- TEST_PROPFIND2 ----------------- |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
213 | // test with multiple namespaces |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
214 | WebdavPropfindRequest *p2 = propfind_parse( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
215 | sn, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
216 | rq, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
217 | TEST_PROPFIND2, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
218 | strlen(TEST_PROPFIND2), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
219 | &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
220 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
221 | UCX_TEST_ASSERT(p2, "p2 is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
222 | UCX_TEST_ASSERT(p2->properties, "p2: no props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
223 | UCX_TEST_ASSERT(!p2->allprop, "p2: allprop is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
224 | UCX_TEST_ASSERT(!p2->propname, "p2: propname is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
225 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
226 | // property 1: DAV:resourcetype |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
227 | elm = p2->properties; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
228 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
229 | !strcmp(elm->property->name, "resourcetype"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
230 | "p2: property 1 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
231 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
232 | !strcmp((char*)elm->property->namespace->href, "DAV:"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
233 | "p2: property 1 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
234 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
235 | // property 2: X:testprop |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
236 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
237 | UCX_TEST_ASSERT(elm, "p2: property 2 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
238 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
239 | !strcmp(elm->property->name, "testprop"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
240 | "p2: property 2 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
241 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
242 | !strcmp((char*)elm->property->namespace->href, "http://example.com/"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
243 | "p2: property 2 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
244 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
245 | // property 3: X:name |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
246 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
247 | UCX_TEST_ASSERT(elm, "p2: property 3 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
248 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
249 | !strcmp(elm->property->name, "name"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
250 | "p2: property 3 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
251 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
252 | !strcmp((char*)elm->property->namespace->href, "http://example.com/"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
253 | "p2: property 3 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
254 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
255 | // property 4: Z:testprop |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
256 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
257 | UCX_TEST_ASSERT(elm, "p2: property 4 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
258 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
259 | !strcmp(elm->property->name, "testprop"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
260 | "p2: property 4 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
261 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
262 | !strcmp((char*)elm->property->namespace->href, "testns"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
263 | "p2: property 4 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
264 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
265 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
266 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
267 | // ----------------- TEST_PROPFIND3 ----------------- |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
268 | // test allprop |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
269 | WebdavPropfindRequest *p3 = propfind_parse(sn, rq, TEST_PROPFIND3, strlen(TEST_PROPFIND3), &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
270 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
271 | UCX_TEST_ASSERT(p3, "p3 is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
272 | UCX_TEST_ASSERT(!p3->properties, "p2: has props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
273 | UCX_TEST_ASSERT(p3->allprop, "p2: allprop is FALSE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
274 | UCX_TEST_ASSERT(!p3->propname, "p2: propname is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
275 | UCX_TEST_ASSERT(p3->propcount == 0, "p2: wrong propcount"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
276 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
277 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
278 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
279 | // ----------------- TEST_PROPFIND4 ----------------- |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
280 | // test propname |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
281 | WebdavPropfindRequest *p4 = propfind_parse(sn, rq, TEST_PROPFIND4, strlen(TEST_PROPFIND4), &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
282 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
283 | UCX_TEST_ASSERT(p4, "p4 is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
284 | UCX_TEST_ASSERT(!p4->properties, "p2: has props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
285 | UCX_TEST_ASSERT(!p4->allprop, "p2: allprop is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
286 | UCX_TEST_ASSERT(p4->propname, "p2: propname is FALSE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
287 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
288 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
289 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
290 | // ----------------- TEST_PROPFIND5 ----------------- |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
291 | // test duplicate check |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
292 | WebdavPropfindRequest *p5 = propfind_parse(sn, rq, TEST_PROPFIND5, strlen(TEST_PROPFIND5), &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
293 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
294 | UCX_TEST_ASSERT(p5, "p5 is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
295 | UCX_TEST_ASSERT(p5->properties, "p5: no props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
296 | UCX_TEST_ASSERT(!p5->allprop, "p5: allprop is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
297 | UCX_TEST_ASSERT(!p5->propname, "p5: propname is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
298 | UCX_TEST_ASSERT(p5->propcount == 4, "p5: wrong propcount"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
299 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
300 | // property 1: DAV:displayname |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
301 | elm = p5->properties; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
302 | UCX_TEST_ASSERT(elm, "p5: property 1 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
303 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
304 | !strcmp(elm->property->name, "displayname"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
305 | "p5: property 1 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
306 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
307 | !strcmp((char*)elm->property->namespace->href, "DAV:"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
308 | "p5: property 1 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
309 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
310 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
311 | UCX_TEST_ASSERT(elm, "p5: property 2 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
312 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
313 | UCX_TEST_ASSERT(elm, "p5: property 3 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
314 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
315 | // property 4: DAV:resourcetype |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
316 | elm = elm->next; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
317 | UCX_TEST_ASSERT(elm, "p5: property 4 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
318 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
319 | !strcmp(elm->property->name, "resourcetype"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
320 | "p5: property 4 has wrong name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
321 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
322 | !strcmp((char*)elm->property->namespace->href, "DAV:"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
323 | "p5: property 4 has wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
324 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
325 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
326 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
327 | // ----------------- TEST_PROPFIND6 ----------------- |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
328 | // test prop/allprop mix |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
329 | WebdavPropfindRequest *p6 = propfind_parse(sn, rq, TEST_PROPFIND6, strlen(TEST_PROPFIND6), &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
330 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
331 | UCX_TEST_ASSERT(p6, "p5 is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
332 | UCX_TEST_ASSERT(!p6->properties, "p5: has props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
333 | UCX_TEST_ASSERT(p6->allprop, "p5: allprop is FALSE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
334 | UCX_TEST_ASSERT(!p6->propname, "p5: propname is TRUE"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
335 | UCX_TEST_ASSERT(p6->propcount == 0, "p5: wrong propcount"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
336 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
337 | UCX_TEST_END |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
338 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
339 | pool_destroy(sn->pool); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
340 | } |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
341 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
342 | UCX_TEST(test_proppatch_parse) { |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
343 | Session *sn = testutil_session(); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
344 | Request *rq = testutil_request(sn->pool, "PROPPATCH", "/"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
345 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
346 | UCX_TEST_BEGIN |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
347 | int error = 0; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
348 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
349 | WebdavProppatchRequest *p1 = proppatch_parse(sn, rq, TEST_PROPPATCH1, strlen(TEST_PROPPATCH1), &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
350 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
351 | UCX_TEST_ASSERT(p1->set, "p1: missing set props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
352 | UCX_TEST_ASSERT(!p1->remove, "p1: has remove props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
353 | UCX_TEST_ASSERT(p1->setcount == 2, "p1: wrong setcount"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
354 | UCX_TEST_ASSERT(p1->set->next, "p1: set plist broken"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
355 | UCX_TEST_ASSERT(!p1->set->next->next, "p1: set plist has no end"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
356 | UCX_TEST_ASSERT(p1->set->property, "p1: missing property ptr in plist"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
357 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
358 | !strcmp(p1->set->property->name, "test"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
359 | "p1: wrong property 1 name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
360 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
361 | WebdavProppatchRequest *p2 = proppatch_parse(sn, rq, TEST_PROPPATCH2, strlen(TEST_PROPPATCH2), &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
362 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
363 | UCX_TEST_ASSERT(p2->set, "p2: missing set props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
364 | UCX_TEST_ASSERT(p2->remove, "p2: missing remove props"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
365 | UCX_TEST_ASSERT(p2->setcount == 4, "p2: wrong setcount"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
366 | UCX_TEST_ASSERT(p2->removecount == 1, "p2: wrong removecount"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
367 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
368 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
369 | !strcmp((char*)p2->set->property->namespace->href, "http://example.com/"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
370 | "p2: set property 1: wrong namespace"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
371 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
372 | !strcmp(p2->set->property->name, "a"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
373 | "p2: set property 1: wrong name"); |
212
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
374 | WSXmlNode *p2set1 = p2->set->property->value.node; |
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
375 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
376 | p2set1->type == WS_NODE_TEXT, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
377 | "p2: set property 1: wrong type"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
378 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
379 | p2set1->content, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
380 | "p2: set property 1: no text"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
381 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
382 | !strcmp((char*)p2set1->content, "test"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
383 | "p2: set property 1: wrong value"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
384 | |
212
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
385 | WSXmlNode *p2set3 = p2->set->next->next->property->value.node; |
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
386 | UCX_TEST_ASSERT(p2set3, "p2: set property 3 missing"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
387 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
388 | p2set3->type == WS_NODE_TEXT, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
389 | "p2: set property 3: wrong type"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
390 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
391 | p2set3->next, |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
392 | "p2: set property 3: missing element X:name"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
393 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
394 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
395 | xmlHasProp(p2set3->next, BAD_CAST"test"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
396 | "p2: set property 3: missing attribute 'test'"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
397 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
398 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
399 | xmlHasProp(p2set3->next, BAD_CAST"abc"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
400 | "p2: set property 3: missing attribute 'abc"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
401 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
402 | xmlChar *value1 = xmlGetProp(p2set3->next, BAD_CAST"test"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
403 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
404 | !strcmp((char*) value1, "test1"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
405 | "p2: set property 3: wrong attribute value 1"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
406 | xmlFree(value1); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
407 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
408 | xmlChar *value2 = xmlGetProp(p2set3->next, BAD_CAST"abc"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
409 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
410 | !strcmp((char*) value2, "def"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
411 | "p2: set property 3: wrong attribute value 2"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
412 | xmlFree(value2); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
413 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
414 | UCX_TEST_ASSERT( |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
415 | !strcmp(p2->remove->property->name, "e"), |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
416 | "p2: wrong remove property"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
417 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
418 | UCX_TEST_END |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
419 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
420 | pool_destroy(sn->pool); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
421 | } |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
422 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
423 | UCX_TEST(test_lock_parse) { |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
424 | Session *sn = testutil_session(); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
425 | Request *rq = testutil_request(sn->pool, "LOCK", "/"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
426 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
427 | UCX_TEST_BEGIN |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
428 | int error = 0; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
429 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
430 | WebdavLockRequest *l1 = lock_parse(sn, rq, TEST_LOCK1, strlen(TEST_LOCK1), &error); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
431 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
432 | UCX_TEST_ASSERT(l1, "l1 is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
433 | UCX_TEST_ASSERT(l1->type == WEBDAV_LOCK_WRITE, "l1: wrong type"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
434 | UCX_TEST_ASSERT(l1->scope == WEBDAV_LOCK_SHARED, "l1: wrong scope"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
435 | UCX_TEST_ASSERT(l1->owner, "l1: owner is NULL"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
436 | UCX_TEST_ASSERT(!strcmp((char*)l1->owner->content, "User"), "l1: wrong owner"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
437 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
438 | UCX_TEST_END |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
439 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
440 | pool_destroy(sn->pool); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
441 | } |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
442 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
443 | UCX_TEST(test_rqbody2buffer) { |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
444 | Session *sn; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
445 | Request *rq; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
446 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
447 | UCX_TEST_BEGIN; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
448 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
449 | // TEST 1 |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
450 | sn = testutil_session(); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
451 | rq = testutil_request(sn->pool, "PUT", "/"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
452 | testutil_request_body(sn, rq, "Hello World!", 12); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
453 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
454 | UcxBuffer *b1 = rqbody2buffer(sn, rq); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
455 | UCX_TEST_ASSERT(b1->size == 12, "b1: wrong size"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
456 | UCX_TEST_ASSERT(!memcmp(b1->space,"Hello World!",12), "b1: wrong content"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
457 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
458 | ucx_buffer_free(b1); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
459 | testutil_destroy_session(sn); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
460 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
461 | // |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
462 | // TEST 2 |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
463 | size_t len1 = 25000; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
464 | unsigned char *body1 = malloc(len1); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
465 | for(int i=0;i<len1;i++) { |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
466 | body1[i] = i; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
467 | } |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
468 | sn = testutil_session(); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
469 | rq = testutil_request(sn->pool, "PUT", "/"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
470 | testutil_request_body(sn, rq, (char*)body1, len1); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
471 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
472 | UcxBuffer *b2 = rqbody2buffer(sn, rq); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
473 | UCX_TEST_ASSERT(b2->size == len1, "b2: wrong size"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
474 | UCX_TEST_ASSERT(!memcmp(b2->space, body1, len1), "b2: wrong content"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
475 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
476 | ucx_buffer_free(b2); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
477 | testutil_destroy_session(sn); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
478 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
479 | UCX_TEST_END; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
480 | } |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
481 | |
215
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
482 | UCX_TEST(test_webdav_plist_iterator) { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
483 | Session *sn; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
484 | Request *rq; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
485 | WebdavPropfindRequest *propfind; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
486 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
487 | UCX_TEST_BEGIN; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
488 | UCX_TEST_ASSERT(!test_init(&sn, &rq, &propfind, TEST_PROPFIND1), "init failed"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
489 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
490 | WebdavPList *properties = propfind->properties; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
491 | size_t count = 0; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
492 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
493 | WebdavPListIterator i = webdav_plist_iterator(&properties); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
494 | WebdavPList *cur; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
495 | while(webdav_plist_iterator_next(&i, &cur)) { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
496 | switch(i.index) { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
497 | case 0: { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
498 | UCX_TEST_ASSERT(!strcmp(cur->property->name, "displayname"), "wrong property 1"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
499 | break; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
500 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
501 | case 1: { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
502 | UCX_TEST_ASSERT(!strcmp(cur->property->name, "getcontentlength"), "wrong property 2"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
503 | break; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
504 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
505 | case 2: { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
506 | UCX_TEST_ASSERT(!strcmp(cur->property->name, "getcontenttype"), "wrong property 3"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
507 | break; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
508 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
509 | case 3: { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
510 | UCX_TEST_ASSERT(!strcmp(cur->property->name, "getlastmodified"), "wrong property 4"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
511 | break; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
512 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
513 | case 4: { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
514 | UCX_TEST_ASSERT(!strcmp(cur->property->name, "resourcetype"), "wrong property 5"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
515 | break; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
516 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
517 | case 5: { |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
518 | UCX_TEST_ASSERT(!strcmp(cur->property->name, "getetag"), "wrong property 6"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
519 | break; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
520 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
521 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
522 | count++; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
523 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
524 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
525 | UCX_TEST_ASSERT(count == propfind->propcount, "wrong count"); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
526 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
527 | |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
528 | UCX_TEST_END; |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
529 | testutil_destroy_session(sn); |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
530 | } |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
531 | |
216
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
532 | UCX_TEST(test_webdav_plist_iterator_remove_current) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
533 | Session *sn; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
534 | Request *rq; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
535 | WebdavPropfindRequest *propfind; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
536 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
537 | UCX_TEST_BEGIN; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
538 | UCX_TEST_ASSERT(!test_init(&sn, &rq, &propfind, TEST_PROPFIND1), "init failed"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
539 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
540 | WebdavPList *properties1 = webdav_plist_clone(sn->pool, propfind->properties); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
541 | WebdavPList *properties2 = webdav_plist_clone(sn->pool, propfind->properties); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
542 | WebdavPList *properties3 = webdav_plist_clone(sn->pool, propfind->properties); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
543 | WebdavPList *properties4 = webdav_plist_clone(sn->pool, propfind->properties); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
544 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
545 | WebdavPListIterator i; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
546 | WebdavPList *cur; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
547 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
548 | // test removal of first element |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
549 | i = webdav_plist_iterator(&properties1); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
550 | while(webdav_plist_iterator_next(&i, &cur)) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
551 | if(i.index == 0) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
552 | webdav_plist_iterator_remove_current(&i); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
553 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
554 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
555 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
556 | UCX_TEST_ASSERT(!properties1->prev, "test1: prev not cleared"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
557 | UCX_TEST_ASSERT(!strcmp(properties1->property->name, "getcontentlength"), "test1: wrong property"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
558 | UCX_TEST_ASSERT(!strcmp(properties1->next->property->name, "getcontenttype"), "test1: wrong property 2"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
559 | UCX_TEST_ASSERT(properties1->next->prev == properties1, "test1: wrong link"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
560 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
561 | // test removal of second element |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
562 | i = webdav_plist_iterator(&properties2); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
563 | while(webdav_plist_iterator_next(&i, &cur)) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
564 | if(i.index == 1) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
565 | webdav_plist_iterator_remove_current(&i); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
566 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
567 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
568 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
569 | UCX_TEST_ASSERT(!strcmp(properties2->next->property->name, "getcontenttype"), "test2: wrong property"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
570 | UCX_TEST_ASSERT(properties2->next->prev == properties2, "test2: wrong link"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
571 | UCX_TEST_ASSERT(webdav_plist_size(properties2) == 5, "test2: wrong size"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
572 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
573 | // remove last element |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
574 | i = webdav_plist_iterator(&properties3); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
575 | while(webdav_plist_iterator_next(&i, &cur)) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
576 | if(i.index == 5) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
577 | webdav_plist_iterator_remove_current(&i); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
578 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
579 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
580 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
581 | UCX_TEST_ASSERT(webdav_plist_size(properties3) == 5, "test3: wrong size"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
582 | UCX_TEST_ASSERT(!strcmp(properties3->next->next->next->next->property->name, "resourcetype"), "test2: wrong property"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
583 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
584 | // remove all elements |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
585 | i = webdav_plist_iterator(&properties4); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
586 | while(webdav_plist_iterator_next(&i, &cur)) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
587 | webdav_plist_iterator_remove_current(&i); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
588 | switch(i.index) { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
589 | case 0: { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
590 | UCX_TEST_ASSERT(!strcmp(properties4->property->name, "getcontentlength"), "test4: wrong property 2"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
591 | UCX_TEST_ASSERT(properties4->prev == NULL, "test4: prev not NULL (0)"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
592 | break; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
593 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
594 | case 1: { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
595 | UCX_TEST_ASSERT(!strcmp(properties4->property->name, "getcontenttype"), "test4: wrong property 3"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
596 | UCX_TEST_ASSERT(properties4->prev == NULL, "test4: prev not NULL (1)"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
597 | break; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
598 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
599 | case 2: { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
600 | UCX_TEST_ASSERT(!strcmp(properties4->property->name, "getlastmodified"), "test4: wrong property 4"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
601 | UCX_TEST_ASSERT(properties4->prev == NULL, "test4: prev not NULL (2)"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
602 | break; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
603 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
604 | case 3: { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
605 | UCX_TEST_ASSERT(!strcmp(properties4->property->name, "resourcetype"), "test4: wrong property 5"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
606 | UCX_TEST_ASSERT(properties4->prev == NULL, "test4: prev not NULL (3)"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
607 | break; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
608 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
609 | case 4: { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
610 | UCX_TEST_ASSERT(!strcmp(properties4->property->name, "getetag"), "test4: wrong property 6"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
611 | UCX_TEST_ASSERT(properties4->prev == NULL, "test4: prev not NULL (4)"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
612 | break; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
613 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
614 | default: { |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
615 | UCX_TEST_ASSERT(i.index <= 5, "fail"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
616 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
617 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
618 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
619 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
620 | UCX_TEST_ASSERT(properties4 == NULL, "test4: list not NULL"); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
621 | |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
622 | UCX_TEST_END; |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
623 | testutil_destroy_session(sn); |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
624 | } |
ce2866ec97f6
add webdav_plist_iterator_remove_current tests and fix some plist related bugs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
215
diff
changeset
|
625 | |
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
626 | UCX_TEST(test_msresponse_addproperty) { |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
627 | Session *sn = testutil_session(); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
628 | Request *rq = testutil_request(sn->pool, "PROPFIND", "/"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
629 | Multistatus *ms = multistatus_response(sn, rq); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
630 | MSResponse *r; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
631 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
632 | UCX_TEST_BEGIN; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
633 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
634 | r = (MSResponse*)ms->response.addresource((WebdavResponse*)ms, "/"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
635 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
636 | WebdavProperty p1; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
637 | WebdavProperty p[16]; |
212
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
638 | const char *names[] = {"a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"}; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
639 | |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
640 | // init test data |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
641 | p1.namespace = webdav_dav_namespace(); |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
642 | p1.lang = NULL; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
643 | p1.name = "test1"; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
644 | p1.value.data = NULL; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
645 | p1.vtype = 0; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
646 | |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
647 | for(int i=0;i<8;i++) { |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
648 | p[i].namespace = webdav_dav_namespace(); |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
649 | p[i].name = names[i]; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
650 | p[i].lang = NULL; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
651 | p[i].value.node = NULL; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
652 | p[1].vtype = 0; |
d7e7ea9c6bc6
refactore webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
653 | } |
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
654 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
655 | UCX_TEST_ASSERT(!r->plist_begin && !r->plist_end, "plist not empty"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
656 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
657 | r->resource.addproperty((WebdavResource*)r, &p1, 200); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
658 | UCX_TEST_ASSERT(r->plist_begin, "!plist_begin"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
659 | UCX_TEST_ASSERT(r->plist_begin == r->plist_end, "plist begin != end"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
660 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
661 | r->resource.addproperty((WebdavResource*)r, &p[0], 404); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
662 | r->resource.addproperty((WebdavResource*)r, &p[1], 404); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
663 | r->resource.addproperty((WebdavResource*)r, &p[2], 403); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
664 | r->resource.addproperty((WebdavResource*)r, &p[3], 403); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
665 | r->resource.addproperty((WebdavResource*)r, &p[4], 403); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
666 | r->resource.addproperty((WebdavResource*)r, &p[5], 403); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
667 | r->resource.addproperty((WebdavResource*)r, &p[6], 500); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
668 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
669 | UCX_TEST_ASSERT(r->plist_begin == r->plist_end, "plist begin != end"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
670 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
671 | UCX_TEST_ASSERT(r->errors, "no prop errors"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
672 | UCX_TEST_ASSERT(r->errors->next, "no second error code"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
673 | UCX_TEST_ASSERT(r->errors->next->next, "no third error code"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
674 | UCX_TEST_ASSERT(!r->errors->next->next->next, "too many error codes"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
675 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
676 | UCX_TEST_ASSERT(ucx_list_size(r->errors->begin) == 2, "404 list size != 2"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
677 | UCX_TEST_ASSERT(ucx_list_size(r->errors->next->begin) == 4, "403 list size != 4"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
678 | UCX_TEST_ASSERT(ucx_list_size(r->errors->next->next->begin) == 1, "500 list size != 1"); |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
679 | |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
680 | UCX_TEST_END; |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
681 | } |
214
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
682 | |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
683 | UCX_TEST(test_webdav_propfind_init) { |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
684 | Session *sn; |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
685 | Request *rq; |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
686 | WebdavPropfindRequest *propfind; |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
687 | UCX_TEST_BEGIN; |
215
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
688 | UCX_TEST_ASSERT(!test_init(&sn, &rq, &propfind, TEST_PROPFIND1), "init failed"); |
214
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
689 | |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
690 | UcxList *requests = NULL; |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
691 | int err = webdav_propfind_init(&backend1, propfind, "/", &requests); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
692 | |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
693 | UCX_TEST_ASSERT(!err, "webdav_propfind_init failed"); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
694 | UCX_TEST_ASSERT(requests, "request list is empty"); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
695 | UCX_TEST_ASSERT(ucx_list_size(requests), "request list has wrong size"); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
696 | |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
697 | WebdavPropfindRequest *p1 = requests->data; |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
698 | WebdavPropfindRequest *p2 = requests->next->data; |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
699 | |
215
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
700 | // backend1 removes the first property from the plist |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
701 | // backend2 should have one property less |
68e824ba4a4f
add plist iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
214
diff
changeset
|
702 | |
214
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
703 | UCX_TEST_ASSERT(p1 && p2, "missing requests objects"); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
704 | UCX_TEST_ASSERT(p1 != p2, "request objects equal"); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
705 | UCX_TEST_ASSERT(p1->properties != p2->properties, "plists equal"); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
706 | UCX_TEST_ASSERT(p1->propcount == p2->propcount + 1, "first property not removed"); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
707 | |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
708 | UCX_TEST_END; |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
709 | |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
710 | pool_destroy(sn->pool); |
4d7ac67a1c14
add tests for webdav_propfind_init and fix wrong backend call
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
212
diff
changeset
|
711 | } |