2014-11-28 14:13:51 +01:00
|
|
|
#include "testutils/FuseAccessTest.h"
|
|
|
|
|
|
|
|
using ::testing::_;
|
2019-10-13 17:49:57 +02:00
|
|
|
using ::testing::Eq;
|
2014-11-28 14:13:51 +01:00
|
|
|
using ::testing::Return;
|
|
|
|
|
|
|
|
class FuseAccessFilenameTest: public FuseAccessTest {
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(FuseAccessFilenameTest, AccessFile) {
|
|
|
|
ReturnIsFileOnLstat("/myfile");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, access(Eq("/myfile"), _))
|
2014-11-28 14:13:51 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
|
|
|
AccessFile("/myfile", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseAccessFilenameTest, AccessFileNested) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsFileOnLstat("/mydir/myfile");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, access(Eq("/mydir/myfile"), _))
|
2014-11-28 14:13:51 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
|
|
|
AccessFile("/mydir/myfile", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseAccessFilenameTest, AccessFileNested2) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2");
|
|
|
|
ReturnIsFileOnLstat("/mydir/mydir2/myfile");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, access(Eq("/mydir/mydir2/myfile"), _))
|
2014-11-28 14:13:51 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
|
|
|
AccessFile("/mydir/mydir2/myfile", 0);
|
|
|
|
}
|