Tue, 27 Jan 2026 20:25:09 +0100
add test_dav_store_stream_webdav
| test/main.c | file | annotate | diff | comparison | revisions | |
| test/webdav_resource.c | file | annotate | diff | comparison | revisions | |
| test/webdav_resource.h | file | annotate | diff | comparison | revisions |
--- a/test/main.c Sun Jan 25 17:53:31 2026 +0100 +++ b/test/main.c Tue Jan 27 20:25:09 2026 +0100 @@ -89,6 +89,7 @@ cx_test_register(suite_webdav, test_dav_exists_webdav); cx_test_register(suite_webdav, test_dav_create_webdav); cx_test_register(suite_webdav, test_dav_store_content_webdav); + cx_test_register(suite_webdav, test_dav_store_stream_webdav); } cx_test_run_stdout(suite);
--- a/test/webdav_resource.c Sun Jan 25 17:53:31 2026 +0100 +++ b/test/webdav_resource.c Tue Jan 27 20:25:09 2026 +0100 @@ -29,6 +29,8 @@ #include "webdav.h" #include "webdav_resource.h" +#include <cx/buffer.h> + CX_TEST_SUBROUTINE(test_default_properties, DavResource *res) { CX_TEST_ASSERT(res->contentlength > 0); CX_TEST_ASSERT(res->creationdate > 0); @@ -103,3 +105,28 @@ dav_session_destroy(sn); } } + +CX_TEST(test_dav_store_stream_webdav) { + CX_TEST_DO { + CX_TEST_DO { + FILE *f = fopen("test_dav_store_stream_webdav.txt", "w+"); + cxstring line = cx_str("test_dav_store_stream_webdav test content\n"); + for(int i=0;i<1000;i++) { + fwrite(line.ptr, 1, line.length, f); + } + fseek(f, 0, SEEK_SET); + size_t len = 1000 * line.length; + + DavSession *sn = get_test_webdav_session(); + DavResource *res = dav_resource_new(sn, "/test_store_file.txt"); + dav_set_content(res, f, (dav_read_func)fread, (dav_seek_func)fseek); + + int ret = dav_store(res); + CX_TEST_ASSERT(!ret); + CX_TEST_ASSERT(!dav_load(res)); + CX_TEST_ASSERT(res->contentlength == len); + dav_session_destroy(sn); + fclose(f); + } + } +}
--- a/test/webdav_resource.h Sun Jan 25 17:53:31 2026 +0100 +++ b/test/webdav_resource.h Tue Jan 27 20:25:09 2026 +0100 @@ -39,6 +39,7 @@ CX_TEST(test_dav_exists_webdav); CX_TEST(test_dav_create_webdav); CX_TEST(test_dav_store_content_webdav); +CX_TEST(test_dav_store_stream_webdav); #ifdef __cplusplus