src/server/test/webdav.c

branch
webdav
changeset 223
bbaec8415c10
parent 222
5f05e56cb8e2
child 227
3c23855f7b46
--- a/src/server/test/webdav.c	Tue Jan 14 20:05:18 2020 +0100
+++ b/src/server/test/webdav.c	Tue Jan 14 22:05:34 2020 +0100
@@ -40,6 +40,8 @@
 #include "vfs.h"
 #include "webdav.h"
 
+static int webdav_is_initialized = 0;
+
 /* ----------------------------- Test Backends --------------------------*/
 
 static int backend2_init_called = 0;
@@ -148,6 +150,13 @@
         WebdavPropfindRequest **out_propfind,
         const char *xml)
 {
+    if(!webdav_is_initialized) {
+        if(webdav_init(NULL, NULL, NULL) != REQ_PROCEED) {
+            return 1;
+        }
+        webdav_is_initialized = 1;
+    }
+    
     Session *sn = testutil_session();
     Request *rq = testutil_request(sn->pool, "PROPFIND", "/");
     
@@ -684,14 +693,17 @@
 }
 
 UCX_TEST(test_msresponse_addproperty) {
-    Session *sn = testutil_session();
-    Request *rq = testutil_request(sn->pool, "PROPFIND", "/");
-    Multistatus *ms = multistatus_response(sn, rq);
-    MSResponse *r;
+    Session *sn;
+    Request *rq;
     
     UCX_TEST_BEGIN;
     
-    r = (MSResponse*)ms->response.addresource((WebdavResponse*)ms, "/");
+    WebdavOperation *op = test_propfind_op(&sn, &rq, TEST_PROPFIND1);
+    UCX_TEST_ASSERT(op, "init failed");
+    UCX_TEST_ASSERT(op->response, "no response");
+    
+    Multistatus *ms = (Multistatus*)op->response;
+    MSResponse *r = (MSResponse*)ms->response.addresource((WebdavResponse*)ms, "/");
     
     WebdavProperty p1;
     WebdavProperty p[16];
@@ -699,6 +711,7 @@
     
     // init test data
     p1.namespace = webdav_dav_namespace();
+    p1.nsdef = NULL;
     p1.lang = NULL;
     p1.name = "test1";
     p1.value.data = NULL;
@@ -706,6 +719,7 @@
     
     for(int i=0;i<8;i++) {
         p[i].namespace = webdav_dav_namespace();
+        p[i].nsdef = NULL;
         p[i].name = names[i];
         p[i].lang = NULL;
         p[i].value.node = NULL;

mercurial