92 |
92 |
93 ucx_test_register(suite, test_pg_webdav_create_from_resdata); |
93 ucx_test_register(suite, test_pg_webdav_create_from_resdata); |
94 ucx_test_register(suite, test_pg_prepare_tests); |
94 ucx_test_register(suite, test_pg_prepare_tests); |
95 ucx_test_register(suite, test_pg_webdav_propfind); |
95 ucx_test_register(suite, test_pg_webdav_propfind); |
96 ucx_test_register(suite, test_pg_webdav_propfind_allprop); |
96 ucx_test_register(suite, test_pg_webdav_propfind_allprop); |
|
97 ucx_test_register(suite, test_pg_webdav_proppatch_set); |
97 |
98 |
98 PGresult *result = PQexec(test_connection, "BEGIN"); |
99 PGresult *result = PQexec(test_connection, "BEGIN"); |
99 PQclear(result); |
100 PQclear(result); |
100 } |
101 } |
101 } |
102 } |
479 VFSContext *vfs = vfs_request_context(sn, rq); |
481 VFSContext *vfs = vfs_request_context(sn, rq); |
480 |
482 |
481 UCX_TEST_BEGIN; |
483 UCX_TEST_BEGIN; |
482 |
484 |
483 vfs_mkdir(vfs, "/propfind"); |
485 vfs_mkdir(vfs, "/propfind"); |
|
486 vfs_mkdir(vfs, "/proppatch"); |
484 SYS_FILE f1; |
487 SYS_FILE f1; |
485 |
488 |
486 int64_t res1_id, res2_id; |
489 int64_t res1_id, res2_id; |
487 |
490 |
488 f1 = vfs_open(vfs, "/propfind/res1", O_WRONLY|O_CREAT); |
491 f1 = vfs_open(vfs, "/propfind/res1", O_WRONLY|O_CREAT); |
502 int r = vfs_mkdir(vfs, "/propfind/sub"); |
505 int r = vfs_mkdir(vfs, "/propfind/sub"); |
503 UCX_TEST_ASSERT(r == 0, "sub create failed"); |
506 UCX_TEST_ASSERT(r == 0, "sub create failed"); |
504 |
507 |
505 f1 = vfs_open(vfs, "/propfind/sub/res4", O_WRONLY|O_CREAT); |
508 f1 = vfs_open(vfs, "/propfind/sub/res4", O_WRONLY|O_CREAT); |
506 UCX_TEST_ASSERT(f1, "res4 create failed"); |
509 UCX_TEST_ASSERT(f1, "res4 create failed"); |
|
510 vfs_close(f1); |
|
511 |
|
512 f1 = vfs_open(vfs, "/proppatch/pp1", O_WRONLY|O_CREAT); |
|
513 UCX_TEST_ASSERT(f1, "pp1 create failed"); |
507 vfs_close(f1); |
514 vfs_close(f1); |
508 |
515 |
509 // 2 properties for res1 |
516 // 2 properties for res1 |
510 char idstr[32]; |
517 char idstr[32]; |
511 snprintf(idstr, 32, "%" PRId64, res1_id); |
518 snprintf(idstr, 32, "%" PRId64, res1_id); |
799 |
806 |
800 |
807 |
801 UCX_TEST_END; |
808 UCX_TEST_END; |
802 } |
809 } |
803 |
810 |
|
811 UCX_TEST(test_pg_webdav_proppatch_set) { |
|
812 Session *sn; |
|
813 Request *rq; |
|
814 TestIOStream *st; |
|
815 pblock *pb; |
|
816 |
|
817 UCX_TEST_BEGIN; |
|
818 |
|
819 // test data: |
|
820 // |
|
821 // /propfind/ |
|
822 // /propfind/res1 (2 properties: test, prop2) |
|
823 // /propfind/res2 (1 property: test) |
|
824 // /propfind/res3 |
|
825 // /propfind/sub |
|
826 // /propfind/sub/res4 |
|
827 |
|
828 int ret; |
|
829 TestResponse *r1; |
|
830 TestProperty *p; |
|
831 // Test 1 |
|
832 init_test_webdav_method(&sn, &rq, &st, &pb, "PROPPATCH", "/proppatch/pp1", PG_TEST_PROPPATCH1); |
|
833 rq->davCollection = create_test_pgdav(sn, rq); |
|
834 |
|
835 ret = webdav_proppatch(pb, sn, rq); |
|
836 UCX_TEST_ASSERT(ret == REQ_PROCEED, "proppatch1 failed"); |
|
837 |
|
838 printf("\n\n%.*s\n", (int)st->buf->size, st->buf->space); |
|
839 |
|
840 TestMultistatus *ms = test_parse_multistatus(st->buf->space, st->buf->size); |
|
841 UCX_TEST_ASSERT(ms, "proppatch1 response is not valid xml"); |
|
842 |
|
843 testutil_destroy_session(sn); |
|
844 test_multistatus_destroy(ms); |
|
845 testutil_iostream_destroy(st); |
|
846 |
|
847 |
|
848 UCX_TEST_END; |
|
849 } |