(t *testing.T)
| 349 | } |
| 350 | |
| 351 | func TestMultistatusWriter(t *testing.T) { |
| 352 | ///The "section x.y.z" test cases come from section x.y.z of the spec at |
| 353 | // http://www.webdav.org/specs/rfc4918.html |
| 354 | testCases := []struct { |
| 355 | desc string |
| 356 | responses []response |
| 357 | respdesc string |
| 358 | writeHeader bool |
| 359 | wantXML string |
| 360 | wantCode int |
| 361 | wantErr error |
| 362 | }{{ |
| 363 | desc: "section 9.2.2 (failed dependency)", |
| 364 | responses: []response{{ |
| 365 | Href: []string{"http://example.com/foo"}, |
| 366 | Propstat: []propstat{{ |
| 367 | Prop: []Property{{ |
| 368 | XMLName: xml.Name{ |
| 369 | Space: "http://ns.example.com/", |
| 370 | Local: "Authors", |
| 371 | }, |
| 372 | }}, |
| 373 | Status: "HTTP/1.1 424 Failed Dependency", |
| 374 | }, { |
| 375 | Prop: []Property{{ |
| 376 | XMLName: xml.Name{ |
| 377 | Space: "http://ns.example.com/", |
| 378 | Local: "Copyright-Owner", |
| 379 | }, |
| 380 | }}, |
| 381 | Status: "HTTP/1.1 409 Conflict", |
| 382 | }}, |
| 383 | ResponseDescription: "Copyright Owner cannot be deleted or altered.", |
| 384 | }}, |
| 385 | wantXML: `` + |
| 386 | `<?xml version="1.0" encoding="UTF-8"?>` + |
| 387 | `<multistatus xmlns="DAV:">` + |
| 388 | ` <response>` + |
| 389 | ` <href>http://example.com/foo</href>` + |
| 390 | ` <propstat>` + |
| 391 | ` <prop>` + |
| 392 | ` <Authors xmlns="http://ns.example.com/"></Authors>` + |
| 393 | ` </prop>` + |
| 394 | ` <status>HTTP/1.1 424 Failed Dependency</status>` + |
| 395 | ` </propstat>` + |
| 396 | ` <propstat xmlns="DAV:">` + |
| 397 | ` <prop>` + |
| 398 | ` <Copyright-Owner xmlns="http://ns.example.com/"></Copyright-Owner>` + |
| 399 | ` </prop>` + |
| 400 | ` <status>HTTP/1.1 409 Conflict</status>` + |
| 401 | ` </propstat>` + |
| 402 | ` <responsedescription>Copyright Owner cannot be deleted or altered.</responsedescription>` + |
| 403 | `</response>` + |
| 404 | `</multistatus>`, |
| 405 | wantCode: StatusMulti, |
| 406 | }, { |
| 407 | desc: "section 9.6.2 (lock-token-submitted)", |
| 408 | responses: []response{{ |
nothing calls this directly
no test coverage detected