Patrick Venture | 123b5c0 | 2019-03-05 14:01:00 -0800 | [diff] [blame] | 1 | #include "internal_sys_mock.hpp" |
| 2 | |
| 3 | #include <ipmiblob/ipmi_errors.hpp> |
| 4 | #include <ipmiblob/ipmi_handler.hpp> |
| 5 | |
Patrick Venture | 1470bec | 2019-03-06 07:33:12 -0800 | [diff] [blame] | 6 | namespace ipmiblob |
Patrick Venture | 123b5c0 | 2019-03-05 14:01:00 -0800 | [diff] [blame] | 7 | { |
| 8 | |
| 9 | using ::testing::_; |
| 10 | using ::testing::Return; |
| 11 | |
| 12 | TEST(IpmiHandlerTest, OpenAllFails) |
| 13 | { |
| 14 | /* Open against all device files fail. */ |
Patrick Venture | 92a4a62 | 2021-02-04 10:45:00 -0800 | [diff] [blame] | 15 | std::unique_ptr<internal::InternalSysMock> sysMock = |
| 16 | std::make_unique<internal::InternalSysMock>(); |
| 17 | EXPECT_CALL(*sysMock, open(_, _)).WillRepeatedly(Return(-1)); |
Patrick Venture | 123b5c0 | 2019-03-05 14:01:00 -0800 | [diff] [blame] | 18 | |
Patrick Venture | 92a4a62 | 2021-02-04 10:45:00 -0800 | [diff] [blame] | 19 | IpmiHandler ipmi(std::move(sysMock)); |
Patrick Venture | 123b5c0 | 2019-03-05 14:01:00 -0800 | [diff] [blame] | 20 | EXPECT_THROW(ipmi.open(), IpmiException); |
| 21 | } |
| 22 | |
Patrick Venture | 1470bec | 2019-03-06 07:33:12 -0800 | [diff] [blame] | 23 | } // namespace ipmiblob |