libcryfs/test/fspp/fuse/openFile/FuseOpenFilenameTest.cpp

37 lines
941 B
C++
Raw Normal View History

2014-11-20 21:23:35 +01:00
#include "testutils/FuseOpenTest.h"
using ::testing::_;
using ::testing::StrEq;
2014-11-25 13:07:15 +01:00
using ::testing::Return;
2014-11-20 21:23:35 +01:00
class FuseOpenFilenameTest: public FuseOpenTest {
public:
};
TEST_F(FuseOpenFilenameTest, OpenFile) {
ReturnIsFileOnLstat("/myfile");
EXPECT_CALL(fsimpl, openFile(StrEq("/myfile"), _))
2014-11-25 13:07:15 +01:00
.Times(1).WillOnce(Return(0));
2014-11-20 21:23:35 +01:00
OpenFile("/myfile", O_RDONLY);
}
TEST_F(FuseOpenFilenameTest, OpenFileNested) {
ReturnIsDirOnLstat("/mydir");
ReturnIsFileOnLstat("/mydir/myfile");
EXPECT_CALL(fsimpl, openFile(StrEq("/mydir/myfile"), _))
2014-11-25 13:07:15 +01:00
.Times(1).WillOnce(Return(0));
2014-11-20 21:23:35 +01:00
OpenFile("/mydir/myfile", O_RDONLY);
}
TEST_F(FuseOpenFilenameTest, OpenFileNested2) {
ReturnIsDirOnLstat("/mydir");
ReturnIsDirOnLstat("/mydir/mydir2");
ReturnIsFileOnLstat("/mydir/mydir2/myfile");
EXPECT_CALL(fsimpl, openFile(StrEq("/mydir/mydir2/myfile"), _))
2014-11-25 13:07:15 +01:00
.Times(1).WillOnce(Return(0));
2014-11-20 21:23:35 +01:00
OpenFile("/mydir/mydir2/myfile", O_RDONLY);
}