diff -r dd6c155c082a -r 2915b6c11aec src/server/test/webdav.c --- a/src/server/test/webdav.c Tue Dec 31 14:07:42 2019 +0100 +++ b/src/server/test/webdav.c Tue Dec 31 14:53:13 2019 +0100 @@ -37,6 +37,7 @@ #include "../webdav/multistatus.h" #include "../webdav/operation.h" +#include "vfs.h" #include "webdav.h" /* ----------------------------- Test Backends --------------------------*/ @@ -790,6 +791,7 @@ UCX_TEST_END; + testutil_destroy_session(sn); } UCX_TEST(test_webdav_op_propfind_children) { @@ -805,8 +807,34 @@ int err = webdav_op_propfind_begin(op, "/", NULL, NULL); UCX_TEST_ASSERT(err == 0, "propfind_begin error"); + // create test vfs with some files (code from test_vfs_readdir) + rq->vfs = testvfs_create(sn); + VFSContext *vfs = vfs_request_context(sn, rq); + UCX_TEST_ASSERT(vfs, "no vfs"); + err = vfs_mkdir(vfs, "/dir"); + UCX_TEST_ASSERT(err == 0, "error not 0"); + // add some test file to /dir + UCX_TEST_ASSERT(vfs_open(vfs, "/dir/file1", O_CREAT), "creation of file1 failed"); + UCX_TEST_ASSERT(vfs_open(vfs, "/dir/file2", O_CREAT), "creation of file2 failed"); + UCX_TEST_ASSERT(vfs_open(vfs, "/dir/file3", O_CREAT), "creation of file3 failed"); + UCX_TEST_ASSERT(vfs_open(vfs, "/dir/file4", O_CREAT), "creation of file4 failed"); + + VFSDir *dir = vfs_opendir(vfs, "/dir"); + UCX_TEST_ASSERT(dir, "dir not opened"); + + UCX_TEST_ASSERT(backend1_propfind_do_count == 1, "backend1 propfind_do not called"); + UCX_TEST_ASSERT(backend2_propfind_do_count == 1, "backend1 propfind_do not called") + + // propfind for all children + err = webdav_op_propfind_children(op, vfs, "/dir"); + UCX_TEST_ASSERT(err == 0, "webdav_op_propfind_children failed"); + + // 1 dir + 4 children + UCX_TEST_ASSERT(backend1_propfind_do_count == 5, "backend1 propfind_do wrong count"); + UCX_TEST_ASSERT(backend2_propfind_do_count == 5, "backend2 propfind_do wrong count"); UCX_TEST_END; + testutil_destroy_session(sn); }