blob: dc6d968b771798854a84fa5ed364329100db9dc3 [file] [log] [blame]
Patrick Ventured333a872018-12-03 16:24:26 -08001#include "data_mock.hpp"
2#include "firmware_handler.hpp"
Patrick Venture1cc88952019-01-04 10:56:32 -08003#include "image_mock.hpp"
Patrick Venture1d66fe62019-06-03 14:57:27 -07004#include "triggerable_mock.hpp"
Patrick Venture7dad86f2019-05-17 08:52:20 -07005#include "util.hpp"
Patrick Ventured333a872018-12-03 16:24:26 -08006
7#include <gtest/gtest.h>
8
Patrick Venture1d5a31c2019-05-20 11:38:22 -07009namespace ipmi_flash
Patrick Ventured333a872018-12-03 16:24:26 -080010{
11using ::testing::Return;
12using ::testing::StrEq;
13using ::testing::StrictMock;
14
Patrick Venture301e5252019-01-10 09:38:12 -080015TEST(FirmwareHandlerBlobTest, VerifyFirmwareCounts)
Patrick Ventured333a872018-12-03 16:24:26 -080016{
17 /* Verify the firmware count must be greater than zero. */
18
19 DataHandlerMock dataMock;
Patrick Venture1cc88952019-01-04 10:56:32 -080020 ImageHandlerMock imageMock;
21 // StrictMock<SdJournalMock> journalMock;
22 // SwapJouralHandler(&journalMock);
Patrick Ventured333a872018-12-03 16:24:26 -080023
Patrick Venture1cc88952019-01-04 10:56:32 -080024 std::vector<HandlerPack> blobs = {
Patrick Venture7dad86f2019-05-17 08:52:20 -070025 {hashBlobId, &imageMock},
Patrick Venture1cc88952019-01-04 10:56:32 -080026 };
Patrick Ventured333a872018-12-03 16:24:26 -080027
28 std::vector<DataHandlerPack> data = {
29 {FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
30 {FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
31 };
32
Patrick Ventured333a872018-12-03 16:24:26 -080033 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
Patrick Venture1d66fe62019-06-03 14:57:27 -070034 blobs, data, CreateTriggerMock(), CreateTriggerMock());
Patrick Ventured333a872018-12-03 16:24:26 -080035
Patrick Venture1cc88952019-01-04 10:56:32 -080036 // EXPECT_EQ(handler, nullptr);
37 EXPECT_FALSE(handler == nullptr);
Patrick Ventured333a872018-12-03 16:24:26 -080038}
39
Patrick Venture1d5a31c2019-05-20 11:38:22 -070040} // namespace ipmi_flash