From 015916c14997b355d63a7189380fe89ae9bbe3bd Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 20 Sep 2020 20:01:05 +0100 Subject: Support for configuring new mappers in fuse client --- netfs/unittests/testFuse.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'netfs/unittests/testFuse.cpp') diff --git a/netfs/unittests/testFuse.cpp b/netfs/unittests/testFuse.cpp index ded7077..0ad9335 100644 --- a/netfs/unittests/testFuse.cpp +++ b/netfs/unittests/testFuse.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -152,3 +153,51 @@ BOOST_AUTO_TEST_CASE(url_params_2) auto fcs = NetFS::FuseApp::configureFromUri("tcp://localhost/foo?0&async=0"); BOOST_CHECK_EQUAL(fcs->Async, false); } + +BOOST_AUTO_TEST_CASE(url_params_hide) +{ + auto fcs = NetFS::FuseApp::configureFromUri("tcp://localhost/foo?mapper=hide"); + BOOST_REQUIRE(fcs->Mapper); + BOOST_REQUIRE(std::dynamic_pointer_cast(fcs->Mapper)); +} + +BOOST_AUTO_TEST_CASE(url_params_mask_default) +{ + auto fcs = NetFS::FuseApp::configureFromUri("tcp://localhost/foo?mapper=mask"); + BOOST_REQUIRE(fcs->Mapper); + auto mapper = std::dynamic_pointer_cast(fcs->Mapper); + BOOST_REQUIRE(mapper); +} + +BOOST_AUTO_TEST_CASE(url_params_mask_nondefault) +{ + auto fcs = NetFS::FuseApp::configureFromUri( + "tcp://localhost/" + "foo?mapper=mask&mapper.unknownuser=uu&mapper.unknowngroup=ug&mapper.usermask=0100&mapper.groupmask=0010"); + BOOST_REQUIRE(fcs->Mapper); + auto mapper = std::dynamic_pointer_cast(fcs->Mapper); + BOOST_REQUIRE(mapper); + BOOST_CHECK_EQUAL(mapper->UnknownUser, "uu"); + BOOST_CHECK_EQUAL(mapper->UnknownGroup, "ug"); + BOOST_CHECK_EQUAL(mapper->UserMask, 0100); + BOOST_CHECK_EQUAL(mapper->GroupMask, 0010); +} + +BOOST_AUTO_TEST_CASE(config_file_hide) +{ + auto fcs = NetFS::FuseApp::configureFromFile(rootDir / "defaultFuseHide.xml", "testvol"); + BOOST_REQUIRE(fcs->Mapper); + BOOST_REQUIRE(std::dynamic_pointer_cast(fcs->Mapper)); +} + +BOOST_AUTO_TEST_CASE(config_file_mask) +{ + auto fcs = NetFS::FuseApp::configureFromFile(rootDir / "defaultFuseMask.xml", "testvol"); + BOOST_REQUIRE(fcs->Mapper); + auto mapper = std::dynamic_pointer_cast(fcs->Mapper); + BOOST_REQUIRE(mapper); + BOOST_CHECK_EQUAL(mapper->UnknownUser, "uu"); + BOOST_CHECK_EQUAL(mapper->UnknownGroup, "ug"); + BOOST_CHECK_EQUAL(mapper->UserMask, 0100); + BOOST_CHECK_EQUAL(mapper->GroupMask, 0010); +} -- cgit v1.2.3