src/server/test/webdav.c

branch
webdav
changeset 219
dd6c155c082a
parent 218
2ba512b284b9
child 220
2915b6c11aec
equal deleted inserted replaced
218:2ba512b284b9 219:dd6c155c082a
40 #include "webdav.h" 40 #include "webdav.h"
41 41
42 /* ----------------------------- Test Backends --------------------------*/ 42 /* ----------------------------- Test Backends --------------------------*/
43 43
44 static int backend2_init_called = 0; 44 static int backend2_init_called = 0;
45 static int backend2_propfind_do_called = 0; 45 static int backend2_propfind_do_count = 0;
46 static int backend2_propfind_finish_called = 0; 46 static int backend2_propfind_finish_called = 0;
47 47
48 // backend2 48 // backend2
49 static int backend2_propfind_init( 49 static int backend2_propfind_init(
50 WebdavPropfindRequest *propfind, 50 WebdavPropfindRequest *propfind,
60 WebdavResponse *response, 60 WebdavResponse *response,
61 VFS_DIR parent, 61 VFS_DIR parent,
62 WebdavResource *resource, 62 WebdavResource *resource,
63 struct stat *s) 63 struct stat *s)
64 { 64 {
65 backend2_propfind_do_called = 1; 65 backend2_propfind_do_count++;
66 return 0; 66 return 0;
67 } 67 }
68 68
69 static int backend2_propfind_finish(WebdavPropfindRequest *propfind) { 69 static int backend2_propfind_finish(WebdavPropfindRequest *propfind) {
70 backend2_propfind_finish_called = 1; 70 backend2_propfind_finish_called = 1;
80 }; 80 };
81 81
82 // backend1 82 // backend1
83 83
84 static int backend1_init_called = 0; 84 static int backend1_init_called = 0;
85 static int backend1_propfind_do_called = 0; 85 static int backend1_propfind_do_count = 0;
86 static int backend1_propfind_finish_called = 0; 86 static int backend1_propfind_finish_called = 0;
87 87
88 88
89 static int backend1_propfind_init( 89 static int backend1_propfind_init(
90 WebdavPropfindRequest *propfind, 90 WebdavPropfindRequest *propfind,
110 WebdavResponse *response, 110 WebdavResponse *response,
111 VFS_DIR parent, 111 VFS_DIR parent,
112 WebdavResource *resource, 112 WebdavResource *resource,
113 struct stat *s) 113 struct stat *s)
114 { 114 {
115 backend1_propfind_do_called = 1; 115 backend1_propfind_do_count++;
116 return 0; 116 return 0;
117 } 117 }
118 118
119 static int backend1_propfind_finish(WebdavPropfindRequest *propfind) { 119 static int backend1_propfind_finish(WebdavPropfindRequest *propfind) {
120 backend1_propfind_finish_called = 1; 120 backend1_propfind_finish_called = 1;
129 &backend2 129 &backend2
130 }; 130 };
131 131
132 static void reset_backends(void) { 132 static void reset_backends(void) {
133 backend1_init_called = 0; 133 backend1_init_called = 0;
134 backend1_propfind_do_called = 0; 134 backend1_propfind_do_count = 0;
135 backend1_propfind_finish_called = 0; 135 backend1_propfind_finish_called = 0;
136 backend2_init_called = 0; 136 backend2_init_called = 0;
137 backend2_propfind_do_called = 0; 137 backend2_propfind_do_count = 0;
138 backend2_propfind_finish_called = 0; 138 backend2_propfind_finish_called = 0;
139 } 139 }
140 140
141 /* ----------------------------------------------------------------------*/ 141 /* ----------------------------------------------------------------------*/
142 142
783 WebdavOperation *op = test_propfind_op(&sn, &rq, TEST_PROPFIND1); 783 WebdavOperation *op = test_propfind_op(&sn, &rq, TEST_PROPFIND1);
784 UCX_TEST_ASSERT(op, "WebdavOperation not created"); 784 UCX_TEST_ASSERT(op, "WebdavOperation not created");
785 785
786 int err = webdav_op_propfind_begin(op, "/", NULL, NULL); 786 int err = webdav_op_propfind_begin(op, "/", NULL, NULL);
787 UCX_TEST_ASSERT(err == 0, "err not 0"); 787 UCX_TEST_ASSERT(err == 0, "err not 0");
788 UCX_TEST_ASSERT(backend1_propfind_do_called == 1, "backend1 propfind_do not called"); 788 UCX_TEST_ASSERT(backend1_propfind_do_count == 1, "backend1 propfind_do not called");
789 UCX_TEST_ASSERT(backend2_propfind_do_called == 1, "backend2 propfind_do not called"); 789 UCX_TEST_ASSERT(backend2_propfind_do_count == 1, "backend2 propfind_do not called");
790 790
791 791
792 UCX_TEST_END; 792 UCX_TEST_END;
793 } 793 }
794
795 UCX_TEST(test_webdav_op_propfind_children) {
796 reset_backends();
797
798 Session *sn;
799 Request *rq;
800
801 UCX_TEST_BEGIN;
802 WebdavOperation *op = test_propfind_op(&sn, &rq, TEST_PROPFIND1);
803 UCX_TEST_ASSERT(op, "WebdavOperation not created");
804
805 int err = webdav_op_propfind_begin(op, "/", NULL, NULL);
806 UCX_TEST_ASSERT(err == 0, "propfind_begin error");
807
808
809
810
811 UCX_TEST_END;
812 }

mercurial