- Added basic WebDAV functionality for interacting with the underlying VFS. - Created unit tests to verify WebDAV methods. - Improved OurDBFS implementation by adding skip attribute to myvfs field.
42 lines
1.1 KiB
V
42 lines
1.1 KiB
V
import freeflowuniverse.herolib.vfs.webdav
|
|
import freeflowuniverse.herolib.vfs.vfsnested
|
|
import freeflowuniverse.herolib.vfs.vfscore
|
|
import freeflowuniverse.herolib.vfs.vfsourdb
|
|
import os
|
|
|
|
fn test_logic() ! {
|
|
println('Testing OurDB VFS Logic to WebDAV Server...')
|
|
|
|
// Create test directories
|
|
test_data_dir := os.join_path(os.temp_dir(), 'vfsourdb_test_data')
|
|
test_meta_dir := os.join_path(os.temp_dir(), 'vfsourdb_test_meta')
|
|
|
|
os.mkdir_all(test_data_dir)!
|
|
os.mkdir_all(test_meta_dir)!
|
|
|
|
defer {
|
|
os.rmdir_all(test_data_dir) or {}
|
|
os.rmdir_all(test_meta_dir) or {}
|
|
}
|
|
|
|
// Create VFS instance; lower level VFS Implementations that use OurDB
|
|
mut vfs1 := vfsourdb.new(test_data_dir, test_meta_dir)!
|
|
|
|
mut high_level_vfs := vfsnested.new()
|
|
|
|
// Nest OurDB VFS instances at different paths
|
|
high_level_vfs.add_vfs('/', vfs1) or { panic(err) }
|
|
|
|
// Test directory listing
|
|
entries := high_level_vfs.dir_list('/')!
|
|
assert entries.len == 1 // Data directory
|
|
|
|
println('entries: ${entries}')
|
|
|
|
// // Check if dir is existing
|
|
// assert high_level_vfs.exists('/') == true
|
|
|
|
// // Check if dir is not existing
|
|
// assert high_level_vfs.exists('/data') == true
|
|
}
|