diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-10-26 20:08:35 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-12-16 20:41:03 +0000 |
commit | e90d3f842e28965a4189be49284fc13052739c09 (patch) | |
tree | 60d4120887d146c00b3d76f50cadf35da650f9d6 | |
parent | Tidy up permissions tests (diff) | |
download | netfs-e90d3f842e28965a4189be49284fc13052739c09.tar.bz2 netfs-e90d3f842e28965a4189be49284fc13052739c09.tar.xz netfs-e90d3f842e28965a4189be49284fc13052739c09.zip |
Improve permissions tests on rename
-rw-r--r-- | netfs/unittests/testCore.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index fbca658..56c695e 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -372,10 +372,14 @@ BOOST_AUTO_TEST_CASE( renameToDir ) memset(&fi, 0, sizeof(fi)); BOOST_REQUIRE_EQUAL(fuse->create("/file", 0600, &fi), 0); BOOST_REQUIRE_EQUAL(fuse->release("/file", &fi), 0); - BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0000), 0); - BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), -EACCES); - BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0700), 0); + BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0700), 0); BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir"), -EISDIR); + disableWriteOnDir(fuse, "/dir"); + BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), -EACCES); + enableWriteOnDir(fuse, "/dir"); + disableWriteOnDir(fuse, "/"); + BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), -EACCES); + enableWriteOnDir(fuse, "/"); BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), 0); BOOST_REQUIRE_EQUAL(fuse->unlink("/file"), -ENOENT); BOOST_REQUIRE_EQUAL(fuse->unlink("/dir/file"), 0); |