blob: 872e08b4a39d173577ccf66491b7074ba15dfa36 [file] [log] [blame]
Patrick Venture123b5c02019-03-05 14:01:00 -08001#include "internal_sys_mock.hpp"
2
3#include <ipmiblob/ipmi_errors.hpp>
4#include <ipmiblob/ipmi_handler.hpp>
5
Patrick Venture1470bec2019-03-06 07:33:12 -08006namespace ipmiblob
Patrick Venture123b5c02019-03-05 14:01:00 -08007{
8
9using ::testing::_;
10using ::testing::Return;
11
12TEST(IpmiHandlerTest, OpenAllFails)
13{
14 /* Open against all device files fail. */
Patrick Venture92a4a622021-02-04 10:45:00 -080015 std::unique_ptr<internal::InternalSysMock> sysMock =
16 std::make_unique<internal::InternalSysMock>();
17 EXPECT_CALL(*sysMock, open(_, _)).WillRepeatedly(Return(-1));
Patrick Venture123b5c02019-03-05 14:01:00 -080018
Patrick Venture92a4a622021-02-04 10:45:00 -080019 IpmiHandler ipmi(std::move(sysMock));
Patrick Venture123b5c02019-03-05 14:01:00 -080020 EXPECT_THROW(ipmi.open(), IpmiException);
21}
22
Patrick Venture1470bec2019-03-06 07:33:12 -080023} // namespace ipmiblob