-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Move MockAppEngine implementation to a new file, allowing reuse
Signed-off-by: Andre Detsch <andre.detsch@foundries.io>
- Loading branch information
Showing
8 changed files
with
54 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Class MockAppEngine | ||
* | ||
*/ | ||
using ::testing::Return; | ||
|
||
class MockAppEngine : public AppEngine { | ||
public: | ||
MockAppEngine(bool default_behaviour = true) { | ||
if (!default_behaviour) return; | ||
|
||
ON_CALL(*this, fetch).WillByDefault(Return(true)); | ||
ON_CALL(*this, verify).WillByDefault(Return(true)); | ||
ON_CALL(*this, install).WillByDefault(Return(true)); | ||
ON_CALL(*this, run).WillByDefault(Return(true)); | ||
ON_CALL(*this, isFetched).WillByDefault(Return(true)); | ||
ON_CALL(*this, isRunning).WillByDefault(Return(true)); | ||
ON_CALL(*this, getRunningAppsInfo) | ||
.WillByDefault( | ||
Return(Utils::parseJSON("{\"app-07\": {\"services\": {\"nginx-07\": {\"hash\": " | ||
"\"16e36b4ab48cb19c7100a22686f85ffcbdce5694c936bda03cb12a2cce88efcf\"}}}}"))); | ||
} | ||
|
||
public: | ||
MOCK_METHOD(AppEngine::Result, fetch, (const App& app), (override)); | ||
MOCK_METHOD(AppEngine::Result, verify, (const App& app), (override)); | ||
MOCK_METHOD(AppEngine::Result, install, (const App& app), (override)); | ||
MOCK_METHOD(AppEngine::Result, run, (const App& app), (override)); | ||
MOCK_METHOD(void, stop, (const App& app), (override)); | ||
MOCK_METHOD(void, remove, (const App& app), (override)); | ||
MOCK_METHOD(bool, isFetched, (const App& app), (const, override)); | ||
MOCK_METHOD(bool, isRunning, (const App& app), (const, override)); | ||
MOCK_METHOD(AppEngine::Apps, getInstalledApps, (), (const, override)); | ||
MOCK_METHOD(Json::Value, getRunningAppsInfo, (), (const, override)); | ||
MOCK_METHOD(void, prune, (const Apps& app), (override)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.