Patrick Venture | d2037c6 | 2019-03-15 10:29:47 -0700 | [diff] [blame^] | 1 | #include "errors.hpp" |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 2 | #include "handler.hpp" |
| 3 | |
| 4 | #include <string> |
| 5 | #include <tuple> |
| 6 | |
| 7 | #include <gtest/gtest.h> |
| 8 | |
| 9 | namespace google |
| 10 | { |
| 11 | namespace ipmi |
| 12 | { |
| 13 | |
| 14 | TEST(HandlerTest, EthCheckValidHappy) |
| 15 | { |
| 16 | // The code returns compiled-in information, and therefore cannot really |
| 17 | // fail. |
| 18 | Handler h; |
| 19 | std::tuple<std::uint8_t, std::string> result = h.getEthDetails(); |
| 20 | EXPECT_EQ(1, std::get<0>(result)); |
| 21 | EXPECT_STREQ("eth0", std::get<1>(result).c_str()); |
| 22 | } |
| 23 | |
Patrick Venture | d2037c6 | 2019-03-15 10:29:47 -0700 | [diff] [blame^] | 24 | TEST(HandlerTest, CableCheckIllegalPath) |
| 25 | { |
| 26 | Handler h; |
| 27 | EXPECT_THROW(h.getRxPackets("eth0/../../"), IpmiException); |
| 28 | } |
| 29 | |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 30 | // TODO: Add checks for other functions of handler. |
| 31 | |
| 32 | } // namespace ipmi |
| 33 | } // namespace google |