summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-02-15 22:15:56 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-02-15 22:15:56 +0000
commitcf4ef3750f117d99de1bc07e0407d811d39ebbe2 (patch)
treeda185871a76652bb4aeda71a5a24bc89acdc118a
parentTest readlink on not a symlink (diff)
downloadnetfs-cf4ef3750f117d99de1bc07e0407d811d39ebbe2.tar.bz2
netfs-cf4ef3750f117d99de1bc07e0407d811d39ebbe2.tar.xz
netfs-cf4ef3750f117d99de1bc07e0407d811d39ebbe2.zip
Test chown behaviour
-rw-r--r--netfs/unittests/testCore.cpp13
1 files changed, 13 insertions, 0 deletions
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 )