Lei YU | f77189f | 2019-08-07 14:26:30 +0800 | [diff] [blame] | 1 | #include "utils.hpp" |
| 2 | |
| 3 | #include <gmock/gmock.h> |
| 4 | |
| 5 | namespace utils |
| 6 | { |
| 7 | |
| 8 | class MockedUtils : public UtilsInterface |
| 9 | { |
| 10 | public: |
| 11 | virtual ~MockedUtils() = default; |
| 12 | |
| 13 | MOCK_CONST_METHOD1(getPSUInventoryPath, |
| 14 | std::vector<std::string>(sdbusplus::bus::bus& bus)); |
| 15 | |
| 16 | MOCK_CONST_METHOD3(getService, |
| 17 | std::string(sdbusplus::bus::bus& bus, const char* path, |
| 18 | const char* interface)); |
| 19 | |
Lei YU | d0bbfa9 | 2019-09-11 16:10:54 +0800 | [diff] [blame] | 20 | MOCK_CONST_METHOD3(getServices, |
| 21 | std::vector<std::string>(sdbusplus::bus::bus& bus, |
| 22 | const char* path, |
| 23 | const char* interface)); |
| 24 | |
Lei YU | f77189f | 2019-08-07 14:26:30 +0800 | [diff] [blame] | 25 | MOCK_CONST_METHOD1(getVersionId, std::string(const std::string& version)); |
| 26 | |
Lei YU | 5f3584d | 2019-08-27 16:28:53 +0800 | [diff] [blame] | 27 | MOCK_CONST_METHOD1(getVersion, |
| 28 | std::string(const std::string& psuInventoryPath)); |
| 29 | |
Lei YU | f77189f | 2019-08-07 14:26:30 +0800 | [diff] [blame] | 30 | MOCK_CONST_METHOD5(getPropertyImpl, |
| 31 | any(sdbusplus::bus::bus& bus, const char* service, |
| 32 | const char* path, const char* interface, |
| 33 | const char* propertyName)); |
| 34 | }; |
| 35 | |
Lei YU | ff83c2a | 2019-09-12 13:55:18 +0800 | [diff] [blame^] | 36 | inline const UtilsInterface& getUtils() |
Lei YU | f77189f | 2019-08-07 14:26:30 +0800 | [diff] [blame] | 37 | { |
| 38 | static MockedUtils utils; |
| 39 | return utils; |
| 40 | } |
| 41 | |
| 42 | } // namespace utils |