mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
integrated uuid_mountpoint_factory
This commit is contained in:
@@ -11,19 +11,19 @@ TEST(uuid_mountpoint_factory, create_existing_dir)
|
||||
{
|
||||
TempDir temp("uuid_mountpoint_factory");
|
||||
|
||||
void * factory = wf_impl_uuid_mountpoint_factory_create(temp.path());
|
||||
ASSERT_NE(nullptr, factory);
|
||||
struct wf_impl_mountpoint_factory factory;
|
||||
bool factory_created = wf_impl_uuid_mountpoint_factory_init(&factory, temp.path());
|
||||
ASSERT_TRUE(factory_created);
|
||||
ASSERT_TRUE(is_dir(temp.path()));
|
||||
|
||||
wf_mountpoint * mountpoint = wf_impl_uuid_mountpoint_factory_create_mountpoint("dummy", factory);
|
||||
wf_mountpoint * mountpoint = wf_impl_mountpoint_factory_create_mountpoint(&factory, "dummy");
|
||||
std::string path = wf_mountpoint_get_path(mountpoint);
|
||||
ASSERT_NE(nullptr, factory);
|
||||
ASSERT_TRUE(is_dir(path));
|
||||
|
||||
wf_mountpoint_dispose(mountpoint);
|
||||
ASSERT_FALSE(is_dir(path));
|
||||
|
||||
wf_impl_uuid_mountpoint_factory_dispose(factory);
|
||||
wf_impl_mountpoint_factory_cleanup(&factory);
|
||||
// keep dir not created by factory
|
||||
ASSERT_TRUE(is_dir(temp.path()));
|
||||
}
|
||||
@@ -33,19 +33,19 @@ TEST(uuid_mountpoint_factory, create_nonexisting_dir)
|
||||
TempDir temp("uuid_mountpoint_factory");
|
||||
std::string root_path = std::string(temp.path()) + "/root";
|
||||
|
||||
void * factory = wf_impl_uuid_mountpoint_factory_create(root_path.c_str());
|
||||
ASSERT_NE(nullptr, factory);
|
||||
struct wf_impl_mountpoint_factory factory;
|
||||
bool factory_created = wf_impl_uuid_mountpoint_factory_init(&factory, root_path.c_str());
|
||||
ASSERT_TRUE(factory_created);
|
||||
ASSERT_TRUE(is_dir(root_path));
|
||||
|
||||
wf_mountpoint * mountpoint = wf_impl_uuid_mountpoint_factory_create_mountpoint("dummy", factory);
|
||||
wf_mountpoint * mountpoint = wf_impl_mountpoint_factory_create_mountpoint(&factory, "dummy");
|
||||
std::string path = wf_mountpoint_get_path(mountpoint);
|
||||
ASSERT_NE(nullptr, factory);
|
||||
ASSERT_TRUE(is_dir(path));
|
||||
|
||||
wf_mountpoint_dispose(mountpoint);
|
||||
ASSERT_FALSE(is_dir(path));
|
||||
|
||||
wf_impl_uuid_mountpoint_factory_dispose(factory);
|
||||
wf_impl_mountpoint_factory_cleanup(&factory);
|
||||
// remove dir, created by factory
|
||||
ASSERT_FALSE(is_dir(root_path));
|
||||
}
|
||||
@@ -55,6 +55,7 @@ TEST(uuid_mountpoint_factory, fail_to_created_nested_dir)
|
||||
TempDir temp("uuid_mountpoint_factory");
|
||||
std::string root_path = std::string(temp.path()) + "/nested/root";
|
||||
|
||||
void * factory = wf_impl_uuid_mountpoint_factory_create(root_path.c_str());
|
||||
ASSERT_EQ(nullptr, factory);
|
||||
struct wf_impl_mountpoint_factory factory;
|
||||
bool factory_created = wf_impl_uuid_mountpoint_factory_init(&factory, root_path.c_str());
|
||||
ASSERT_FALSE(factory_created);
|
||||
}
|
||||
Reference in New Issue
Block a user