blob: 8eb36c6a8641328c1e12e8a0984406763ce0ebdc [file] [log] [blame]
Patrick Ventured333a872018-12-03 16:24:26 -08001#include "data_mock.hpp"
2#include "firmware_handler.hpp"
Patrick Venture84778b82019-06-26 20:11:09 -07003#include "flags.hpp"
Patrick Venture1cc88952019-01-04 10:56:32 -08004#include "image_mock.hpp"
Patrick Venture1d66fe62019-06-03 14:57:27 -07005#include "triggerable_mock.hpp"
Patrick Venture7dad86f2019-05-17 08:52:20 -07006#include "util.hpp"
Patrick Ventured333a872018-12-03 16:24:26 -08007
Patrick Ventured4e20de2019-07-18 12:48:05 -07008#include <memory>
9
Patrick Ventured333a872018-12-03 16:24:26 -080010#include <gtest/gtest.h>
11
Patrick Venture1d5a31c2019-05-20 11:38:22 -070012namespace ipmi_flash
Patrick Ventured333a872018-12-03 16:24:26 -080013{
Patrick Venturefa06a5f2019-07-01 09:22:38 -070014namespace
15{
16
Patrick Ventured333a872018-12-03 16:24:26 -080017using ::testing::Return;
18using ::testing::StrEq;
19using ::testing::StrictMock;
20
Patrick Venture301e5252019-01-10 09:38:12 -080021TEST(FirmwareHandlerBlobTest, VerifyFirmwareCounts)
Patrick Ventured333a872018-12-03 16:24:26 -080022{
23 /* Verify the firmware count must be greater than zero. */
24
25 DataHandlerMock dataMock;
Patrick Venture1cc88952019-01-04 10:56:32 -080026 ImageHandlerMock imageMock;
27 // StrictMock<SdJournalMock> journalMock;
28 // SwapJouralHandler(&journalMock);
Patrick Ventured333a872018-12-03 16:24:26 -080029
Patrick Ventured4e20de2019-07-18 12:48:05 -070030 std::vector<HandlerPack> blobs;
31 blobs.push_back(std::move(
32 HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
Patrick Ventured333a872018-12-03 16:24:26 -080033
34 std::vector<DataHandlerPack> data = {
Patrick Venture84778b82019-06-26 20:11:09 -070035 {FirmwareFlags::UpdateFlags::ipmi, nullptr},
36 {FirmwareFlags::UpdateFlags::lpc, &dataMock},
Patrick Ventured333a872018-12-03 16:24:26 -080037 };
38
Patrick Ventured333a872018-12-03 16:24:26 -080039 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
Patrick Ventured4e20de2019-07-18 12:48:05 -070040 std::move(blobs), data, std::move(CreateActionMap("abcd")));
Patrick Ventured333a872018-12-03 16:24:26 -080041
Patrick Venture1cc88952019-01-04 10:56:32 -080042 // EXPECT_EQ(handler, nullptr);
43 EXPECT_FALSE(handler == nullptr);
Patrick Ventured333a872018-12-03 16:24:26 -080044}
45
Patrick Venturefa06a5f2019-07-01 09:22:38 -070046} // namespace
Patrick Venture1d5a31c2019-05-20 11:38:22 -070047} // namespace ipmi_flash