Adapt test cases to the removal of --extpass parameter

This commit is contained in:
Sebastian Messmer 2016-02-13 11:38:56 +01:00
parent f433da7dc1
commit 1fd2cac9cd
2 changed files with 14 additions and 29 deletions

View File

@ -114,11 +114,6 @@ TEST_F(ProgramOptionsParserTest, InvalidCipher) {
); );
} }
TEST_F(ProgramOptionsParserTest, ExtPassGiven) {
ProgramOptions options = parse({"./myExecutable", "/home/user/baseDir", "--extpass", "echo mypassword", "/home/user/mountDir"});
EXPECT_EQ("echo mypassword", options.extPass().value());
}
TEST_F(ProgramOptionsParserTest, FuseOptionGiven) { TEST_F(ProgramOptionsParserTest, FuseOptionGiven) {
ProgramOptions options = parse({"./myExecutable", "/home/user/baseDir", "/home/user/mountDir", "--", "-f"}); ProgramOptions options = parse({"./myExecutable", "/home/user/baseDir", "/home/user/mountDir", "--", "-f"});
EXPECT_EQ("/home/user/baseDir", options.baseDir()); EXPECT_EQ("/home/user/baseDir", options.baseDir());

View File

@ -23,83 +23,73 @@ namespace boost {
class ProgramOptionsTest: public ProgramOptionsTestBase {}; class ProgramOptionsTest: public ProgramOptionsTestBase {};
TEST_F(ProgramOptionsTest, BaseDir) { TEST_F(ProgramOptionsTest, BaseDir) {
ProgramOptions testobj("/home/user/mydir", "", none, false, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("/home/user/mydir", "", none, false, none, none, none, options({"./myExecutable"}));
EXPECT_EQ("/home/user/mydir", testobj.baseDir()); EXPECT_EQ("/home/user/mydir", testobj.baseDir());
} }
TEST_F(ProgramOptionsTest, MountDir) { TEST_F(ProgramOptionsTest, MountDir) {
ProgramOptions testobj("", "/home/user/mydir", none, false, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "/home/user/mydir", none, false, none, none, none, options({"./myExecutable"}));
EXPECT_EQ("/home/user/mydir", testobj.mountDir()); EXPECT_EQ("/home/user/mydir", testobj.mountDir());
} }
TEST_F(ProgramOptionsTest, ConfigfileNone) { TEST_F(ProgramOptionsTest, ConfigfileNone) {
ProgramOptions testobj("", "", none, true, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, none, none, none, options({"./myExecutable"}));
EXPECT_EQ(none, testobj.configFile()); EXPECT_EQ(none, testobj.configFile());
} }
TEST_F(ProgramOptionsTest, ConfigfileSome) { TEST_F(ProgramOptionsTest, ConfigfileSome) {
ProgramOptions testobj("", "", bf::path("/home/user/configfile"), true, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", bf::path("/home/user/configfile"), true, none, none, none, options({"./myExecutable"}));
EXPECT_EQ("/home/user/configfile", testobj.configFile().get()); EXPECT_EQ("/home/user/configfile", testobj.configFile().get());
} }
TEST_F(ProgramOptionsTest, ForegroundFalse) { TEST_F(ProgramOptionsTest, ForegroundFalse) {
ProgramOptions testobj("", "", none, false, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, false, none, none, none, options({"./myExecutable"}));
EXPECT_FALSE(testobj.foreground()); EXPECT_FALSE(testobj.foreground());
} }
TEST_F(ProgramOptionsTest, ForegroundTrue) { TEST_F(ProgramOptionsTest, ForegroundTrue) {
ProgramOptions testobj("", "", none, true, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, none, none, none, options({"./myExecutable"}));
EXPECT_TRUE(testobj.foreground()); EXPECT_TRUE(testobj.foreground());
} }
TEST_F(ProgramOptionsTest, LogfileNone) { TEST_F(ProgramOptionsTest, LogfileNone) {
ProgramOptions testobj("", "", none, true, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, none, none, none, options({"./myExecutable"}));
EXPECT_EQ(none, testobj.logFile()); EXPECT_EQ(none, testobj.logFile());
} }
TEST_F(ProgramOptionsTest, LogfileSome) { TEST_F(ProgramOptionsTest, LogfileSome) {
ProgramOptions testobj("", "", none, true, none, bf::path("logfile"), none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, none, bf::path("logfile"), none, options({"./myExecutable"}));
EXPECT_EQ("logfile", testobj.logFile().get()); EXPECT_EQ("logfile", testobj.logFile().get());
} }
TEST_F(ProgramOptionsTest, UnmountAfterIdleMinutesNone) { TEST_F(ProgramOptionsTest, UnmountAfterIdleMinutesNone) {
ProgramOptions testobj("", "", none, true, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, none, none, none, options({"./myExecutable"}));
EXPECT_EQ(none, testobj.unmountAfterIdleMinutes()); EXPECT_EQ(none, testobj.unmountAfterIdleMinutes());
} }
TEST_F(ProgramOptionsTest, UnmountAfterIdleMinutesSome) { TEST_F(ProgramOptionsTest, UnmountAfterIdleMinutesSome) {
ProgramOptions testobj("", "", none, true, 10, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, 10, none, none, options({"./myExecutable"}));
EXPECT_EQ(10, testobj.unmountAfterIdleMinutes().get()); EXPECT_EQ(10, testobj.unmountAfterIdleMinutes().get());
} }
TEST_F(ProgramOptionsTest, CipherNone) { TEST_F(ProgramOptionsTest, CipherNone) {
ProgramOptions testobj("", "", none, true, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, none, none, none, options({"./myExecutable"}));
EXPECT_EQ(none, testobj.cipher()); EXPECT_EQ(none, testobj.cipher());
} }
TEST_F(ProgramOptionsTest, CipherSome) { TEST_F(ProgramOptionsTest, CipherSome) {
ProgramOptions testobj("", "", none, true, none, none, string("aes-256-gcm"), none, options({"./myExecutable"})); ProgramOptions testobj("", "", none, true, none, none, string("aes-256-gcm"), options({"./myExecutable"}));
EXPECT_EQ("aes-256-gcm", testobj.cipher().get()); EXPECT_EQ("aes-256-gcm", testobj.cipher().get());
} }
TEST_F(ProgramOptionsTest, ExtPassNone) {
ProgramOptions testobj("", "", none, true, none, none, none, none, options({"./myExecutable"}));
EXPECT_EQ(none, testobj.extPass());
}
TEST_F(ProgramOptionsTest, ExtPassSome) {
ProgramOptions testobj("", "", none, true, none, none, none, string("echo mypassword"), options({"./myExecutable"}));
EXPECT_EQ("echo mypassword", testobj.extPass().get());
}
TEST_F(ProgramOptionsTest, EmptyFuseOptions) { TEST_F(ProgramOptionsTest, EmptyFuseOptions) {
ProgramOptions testobj("/rootDir", "/home/user/mydir", none, false, none, none, none, none, options({"./myExecutable"})); ProgramOptions testobj("/rootDir", "/home/user/mydir", none, false, none, none, none, options({"./myExecutable"}));
//Fuse should have the mount dir as first parameter //Fuse should have the mount dir as first parameter
EXPECT_VECTOR_EQ({"./myExecutable", "/home/user/mydir"}, testobj.fuseOptions()); EXPECT_VECTOR_EQ({"./myExecutable", "/home/user/mydir"}, testobj.fuseOptions());
} }
TEST_F(ProgramOptionsTest, SomeFuseOptions) { TEST_F(ProgramOptionsTest, SomeFuseOptions) {
ProgramOptions testobj("/rootDir", "/home/user/mydir", none, false, none, none, none, none, options({"./myExecutable", "-f", "--longoption"})); ProgramOptions testobj("/rootDir", "/home/user/mydir", none, false, none, none, none, options({"./myExecutable", "-f", "--longoption"}));
//Fuse should have the mount dir as first parameter //Fuse should have the mount dir as first parameter
EXPECT_VECTOR_EQ({"./myExecutable", "/home/user/mydir", "-f", "--longoption"}, testobj.fuseOptions()); EXPECT_VECTOR_EQ({"./myExecutable", "/home/user/mydir", "-f", "--longoption"}, testobj.fuseOptions());
} }