blob: d7b99a6cfb465b5ca50e8ebb1f3c1fd55da27c53 [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
8#include <gtest/gtest.h>
9
Patrick Venture1d5a31c2019-05-20 11:38:22 -070010namespace ipmi_flash
Patrick Ventured333a872018-12-03 16:24:26 -080011{
12using ::testing::Return;
13using ::testing::StrEq;
14using ::testing::StrictMock;
15
Patrick Venture301e5252019-01-10 09:38:12 -080016TEST(FirmwareHandlerBlobTest, VerifyFirmwareCounts)
Patrick Ventured333a872018-12-03 16:24:26 -080017{
18 /* Verify the firmware count must be greater than zero. */
19
20 DataHandlerMock dataMock;
Patrick Venture1cc88952019-01-04 10:56:32 -080021 ImageHandlerMock imageMock;
22 // StrictMock<SdJournalMock> journalMock;
23 // SwapJouralHandler(&journalMock);
Patrick Ventured333a872018-12-03 16:24:26 -080024
Patrick Venture1cc88952019-01-04 10:56:32 -080025 std::vector<HandlerPack> blobs = {
Patrick Venture7dad86f2019-05-17 08:52:20 -070026 {hashBlobId, &imageMock},
Patrick Venture1cc88952019-01-04 10:56:32 -080027 };
Patrick Ventured333a872018-12-03 16:24:26 -080028
29 std::vector<DataHandlerPack> data = {
Patrick Venture84778b82019-06-26 20:11:09 -070030 {FirmwareFlags::UpdateFlags::ipmi, nullptr},
31 {FirmwareFlags::UpdateFlags::lpc, &dataMock},
Patrick Ventured333a872018-12-03 16:24:26 -080032 };
33
Patrick Ventured333a872018-12-03 16:24:26 -080034 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
Patrick Venture6d7735d2019-06-21 10:03:19 -070035 blobs, data, CreateTriggerMock(), CreateTriggerMock(),
36 CreateTriggerMock());
Patrick Ventured333a872018-12-03 16:24:26 -080037
Patrick Venture1cc88952019-01-04 10:56:32 -080038 // EXPECT_EQ(handler, nullptr);
39 EXPECT_FALSE(handler == nullptr);
Patrick Ventured333a872018-12-03 16:24:26 -080040}
41
Patrick Venture1d5a31c2019-05-20 11:38:22 -070042} // namespace ipmi_flash