From cf4ef3750f117d99de1bc07e0407d811d39ebbe2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 15 Feb 2016 22:15:56 +0000 Subject: Test chown behaviour --- netfs/unittests/testCore.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index ffdc411..f72770c 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -312,6 +312,19 @@ BOOST_AUTO_TEST_CASE( renameToDir ) BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir"), 0); } +BOOST_AUTO_TEST_CASE( chown ) +{ + BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0777), 0); + BOOST_REQUIRE_EQUAL(fuse->chown("/dir", getuid(), getgid()), 0); + struct stat st; + memset(&st, 0, sizeof(st)); + BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), 0); + BOOST_REQUIRE_EQUAL(st.st_uid, getuid()); + BOOST_REQUIRE_EQUAL(st.st_gid, getgid()); + BOOST_REQUIRE_EQUAL(fuse->chown("/dir", -2, getgid()), -EPERM); + BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir"), 0); +} + BOOST_AUTO_TEST_SUITE_END(); BOOST_AUTO_TEST_CASE( testNoAuthNoPass ) -- cgit v1.2.3