MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / TestReadPropfind

Function TestReadPropfind

server/webdav/xml_test.go:138–349  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

136}
137
138func TestReadPropfind(t *testing.T) {
139 testCases := []struct {
140 desc string
141 input string
142 wantPF propfind
143 wantStatus int
144 }{{
145 desc: "propfind: propname",
146 input: "" +
147 "<A:propfind xmlns:A='DAV:'>\n" +
148 " <A:propname/>\n" +
149 "</A:propfind>",
150 wantPF: propfind{
151 XMLName: ixml.Name{Space: "DAV:", Local: "propfind"},
152 Propname: new(struct{}),
153 },
154 }, {
155 desc: "propfind: empty body means allprop",
156 input: "",
157 wantPF: propfind{
158 Allprop: new(struct{}),
159 },
160 }, {
161 desc: "propfind: allprop",
162 input: "" +
163 "<A:propfind xmlns:A='DAV:'>\n" +
164 " <A:allprop/>\n" +
165 "</A:propfind>",
166 wantPF: propfind{
167 XMLName: ixml.Name{Space: "DAV:", Local: "propfind"},
168 Allprop: new(struct{}),
169 },
170 }, {
171 desc: "propfind: allprop followed by include",
172 input: "" +
173 "<A:propfind xmlns:A='DAV:'>\n" +
174 " <A:allprop/>\n" +
175 " <A:include><A:displayname/></A:include>\n" +
176 "</A:propfind>",
177 wantPF: propfind{
178 XMLName: ixml.Name{Space: "DAV:", Local: "propfind"},
179 Allprop: new(struct{}),
180 Include: propfindProps{xml.Name{Space: "DAV:", Local: "displayname"}},
181 },
182 }, {
183 desc: "propfind: include followed by allprop",
184 input: "" +
185 "<A:propfind xmlns:A='DAV:'>\n" +
186 " <A:include><A:displayname/></A:include>\n" +
187 " <A:allprop/>\n" +
188 "</A:propfind>",
189 wantPF: propfind{
190 XMLName: ixml.Name{Space: "DAV:", Local: "propfind"},
191 Allprop: new(struct{}),
192 Include: propfindProps{xml.Name{Space: "DAV:", Local: "displayname"}},
193 },
194 }, {
195 desc: "propfind: propfind",

Callers

nothing calls this directly

Calls 1

readPropfindFunction · 0.85

Tested by

no test coverage detected