38 #include "../webdav/operation.h" |
38 #include "../webdav/operation.h" |
39 |
39 |
40 #include "vfs.h" |
40 #include "vfs.h" |
41 #include "webdav.h" |
41 #include "webdav.h" |
42 |
42 |
|
43 static int webdav_is_initialized = 0; |
|
44 |
43 /* ----------------------------- Test Backends --------------------------*/ |
45 /* ----------------------------- Test Backends --------------------------*/ |
44 |
46 |
45 static int backend2_init_called = 0; |
47 static int backend2_init_called = 0; |
46 static int backend2_propfind_do_count = 0; |
48 static int backend2_propfind_do_count = 0; |
47 static int backend2_propfind_finish_called = 0; |
49 static int backend2_propfind_finish_called = 0; |
146 Session **out_sn, |
148 Session **out_sn, |
147 Request **out_rq, |
149 Request **out_rq, |
148 WebdavPropfindRequest **out_propfind, |
150 WebdavPropfindRequest **out_propfind, |
149 const char *xml) |
151 const char *xml) |
150 { |
152 { |
|
153 if(!webdav_is_initialized) { |
|
154 if(webdav_init(NULL, NULL, NULL) != REQ_PROCEED) { |
|
155 return 1; |
|
156 } |
|
157 webdav_is_initialized = 1; |
|
158 } |
|
159 |
151 Session *sn = testutil_session(); |
160 Session *sn = testutil_session(); |
152 Request *rq = testutil_request(sn->pool, "PROPFIND", "/"); |
161 Request *rq = testutil_request(sn->pool, "PROPFIND", "/"); |
153 |
162 |
154 int error = 0; |
163 int error = 0; |
155 |
164 |
682 UCX_TEST_END; |
691 UCX_TEST_END; |
683 testutil_destroy_session(sn); |
692 testutil_destroy_session(sn); |
684 } |
693 } |
685 |
694 |
686 UCX_TEST(test_msresponse_addproperty) { |
695 UCX_TEST(test_msresponse_addproperty) { |
687 Session *sn = testutil_session(); |
696 Session *sn; |
688 Request *rq = testutil_request(sn->pool, "PROPFIND", "/"); |
697 Request *rq; |
689 Multistatus *ms = multistatus_response(sn, rq); |
|
690 MSResponse *r; |
|
691 |
698 |
692 UCX_TEST_BEGIN; |
699 UCX_TEST_BEGIN; |
693 |
700 |
694 r = (MSResponse*)ms->response.addresource((WebdavResponse*)ms, "/"); |
701 WebdavOperation *op = test_propfind_op(&sn, &rq, TEST_PROPFIND1); |
|
702 UCX_TEST_ASSERT(op, "init failed"); |
|
703 UCX_TEST_ASSERT(op->response, "no response"); |
|
704 |
|
705 Multistatus *ms = (Multistatus*)op->response; |
|
706 MSResponse *r = (MSResponse*)ms->response.addresource((WebdavResponse*)ms, "/"); |
695 |
707 |
696 WebdavProperty p1; |
708 WebdavProperty p1; |
697 WebdavProperty p[16]; |
709 WebdavProperty p[16]; |
698 const char *names[] = {"a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"}; |
710 const char *names[] = {"a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"}; |
699 |
711 |
700 // init test data |
712 // init test data |
701 p1.namespace = webdav_dav_namespace(); |
713 p1.namespace = webdav_dav_namespace(); |
|
714 p1.nsdef = NULL; |
702 p1.lang = NULL; |
715 p1.lang = NULL; |
703 p1.name = "test1"; |
716 p1.name = "test1"; |
704 p1.value.data = NULL; |
717 p1.value.data = NULL; |
705 p1.vtype = 0; |
718 p1.vtype = 0; |
706 |
719 |
707 for(int i=0;i<8;i++) { |
720 for(int i=0;i<8;i++) { |
708 p[i].namespace = webdav_dav_namespace(); |
721 p[i].namespace = webdav_dav_namespace(); |
|
722 p[i].nsdef = NULL; |
709 p[i].name = names[i]; |
723 p[i].name = names[i]; |
710 p[i].lang = NULL; |
724 p[i].lang = NULL; |
711 p[i].value.node = NULL; |
725 p[i].value.node = NULL; |
712 p[1].vtype = 0; |
726 p[1].vtype = 0; |
713 } |
727 } |