Use NiceMock to reduce the log size on Travis CI because we're close to the 4MB limit
This commit is contained in:
parent
968f183e19
commit
10f8adbb73
@ -15,6 +15,7 @@ using std::string;
|
||||
using std::shared_ptr;
|
||||
using std::make_shared;
|
||||
using ::testing::_;
|
||||
using ::testing::NiceMock;
|
||||
using ::testing::Return;
|
||||
using ::testing::ValuesIn;
|
||||
using ::testing::HasSubstr;
|
||||
@ -24,11 +25,11 @@ using ::testing::WithParamInterface;
|
||||
class CryConfigConsoleTest: public ::testing::Test {
|
||||
public:
|
||||
CryConfigConsoleTest()
|
||||
: console(make_shared<MockConsole>()),
|
||||
: console(make_shared<NiceMock<MockConsole>>()),
|
||||
cryconsole(console),
|
||||
noninteractiveCryconsole(make_shared<NoninteractiveConsole>(console)) {
|
||||
}
|
||||
shared_ptr<MockConsole> console;
|
||||
shared_ptr<NiceMock<MockConsole>> console;
|
||||
CryConfigConsole cryconsole;
|
||||
CryConfigConsole noninteractiveCryconsole;
|
||||
};
|
||||
|
@ -20,6 +20,7 @@ using ::testing::_;
|
||||
using ::testing::Return;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::UnorderedElementsAreArray;
|
||||
using ::testing::NiceMock;
|
||||
|
||||
#define EXPECT_ASK_TO_USE_DEFAULT_SETTINGS() \
|
||||
EXPECT_CALL(*console, askYesNo("Use default settings?", true)).Times(1)
|
||||
@ -43,14 +44,14 @@ using ::testing::UnorderedElementsAreArray;
|
||||
class CryConfigCreatorTest: public ::testing::Test, TestWithFakeHomeDirectory {
|
||||
public:
|
||||
CryConfigCreatorTest()
|
||||
: console(make_shared<MockConsole>()),
|
||||
: console(make_shared<NiceMock<MockConsole>>()),
|
||||
tempLocalStateDir(), localStateDir(tempLocalStateDir.path()),
|
||||
creator(console, cpputils::Random::PseudoRandom(), localStateDir),
|
||||
noninteractiveCreator(make_shared<NoninteractiveConsole>(console), cpputils::Random::PseudoRandom(), localStateDir) {
|
||||
EXPECT_CALL(*console, ask(HasSubstr("block cipher"), _)).WillRepeatedly(ChooseAnyCipher());
|
||||
EXPECT_CALL(*console, ask(HasSubstr("block size"), _)).WillRepeatedly(Return(0));
|
||||
}
|
||||
shared_ptr<MockConsole> console;
|
||||
shared_ptr<NiceMock<MockConsole>> console;
|
||||
cpputils::TempDir tempLocalStateDir;
|
||||
LocalStateDir localStateDir;
|
||||
CryConfigCreator creator;
|
||||
|
@ -23,7 +23,7 @@ class TestWithMockConsole {
|
||||
public:
|
||||
// Return a console that chooses a valid cryfs setting
|
||||
static std::shared_ptr<MockConsole> mockConsole() {
|
||||
auto console = std::make_shared<MockConsole>();
|
||||
auto console = std::make_shared<::testing::NiceMock<MockConsole>>();
|
||||
EXPECT_CALL(*console, ask(::testing::_, ::testing::_)).WillRepeatedly(ChooseCipher("aes-256-gcm"));
|
||||
EXPECT_CALL(*console, askYesNo(::testing::_, ::testing::_)).WillRepeatedly(::testing::Return(true));
|
||||
return console;
|
||||
|
Loading…
Reference in New Issue
Block a user