1102 |
1102 |
1103 pblock_nvinsert("path", "/", rq->vars); |
1103 pblock_nvinsert("path", "/", rq->vars); |
1104 pblock_nvinsert("uri", "/", rq->reqpb); |
1104 pblock_nvinsert("uri", "/", rq->reqpb); |
1105 |
1105 |
1106 st = testutil_iostream(2048, TRUE); |
1106 st = testutil_iostream(2048, TRUE); |
1107 sn->csd = st; |
1107 sn->csd = (IOStream*)st; |
1108 |
1108 |
1109 if(request_body) { |
1109 if(request_body) { |
1110 testutil_request_body(sn, rq, request_body, strlen(request_body)); |
1110 testutil_request_body(sn, rq, request_body, strlen(request_body)); |
1111 } |
1111 } |
1112 |
1112 |
1722 UCX_TEST_ASSERT(err == 0, "DELETE /dir2 failed"); |
1722 UCX_TEST_ASSERT(err == 0, "DELETE /dir2 failed"); |
1723 UCX_TEST_ASSERT(delete_count == 8, "del2: wrong delete count"); |
1723 UCX_TEST_ASSERT(delete_count == 8, "del2: wrong delete count"); |
1724 |
1724 |
1725 UCX_TEST_END; |
1725 UCX_TEST_END; |
1726 } |
1726 } |
|
1727 |
|
1728 UCX_TEST(test_webdav_put) { |
|
1729 Session *sn; |
|
1730 Request *rq; |
|
1731 TestIOStream *st; |
|
1732 pblock *pb; |
|
1733 |
|
1734 const char *content_const = "Hello World"; |
|
1735 |
|
1736 init_test_webdav_method(&sn, &rq, &st, &pb, "PUT", content_const); |
|
1737 rq->vfs = testvfs_create(sn); |
|
1738 |
|
1739 UCX_TEST_BEGIN; |
|
1740 |
|
1741 int err; |
|
1742 |
|
1743 pblock_replace("path", "/file0", rq->vars); |
|
1744 err = webdav_put(NULL, sn, rq); |
|
1745 |
|
1746 UCX_TEST_ASSERT(err == REQ_PROCEED, "put failed"); |
|
1747 |
|
1748 VFSContext *vfs = vfs_request_context(sn, rq); |
|
1749 SYS_FILE f0 = vfs_open(vfs, "/file0", 0); |
|
1750 UCX_TEST_ASSERT(f0, "cannot open file0"); |
|
1751 |
|
1752 char buf[1024]; |
|
1753 int r = system_fread(f0, buf, 1024); |
|
1754 |
|
1755 UCX_TEST_ASSERT(r == strlen(content_const), "wrong file size"); |
|
1756 UCX_TEST_ASSERT(!memcmp(content_const, buf, r), "wrong file content"); |
|
1757 |
|
1758 testutil_destroy_session(sn); |
|
1759 testutil_iostream_destroy(st); |
|
1760 |
|
1761 UCX_TEST_END; |
|
1762 } |