blob: 3bc52fe74f0b9bc47ef34924e04a8bc2d6b1da20 [file] [log] [blame]
Patrick Venture27ac5822019-05-20 17:39:31 -07001#include "bmc_update_mock.hpp"
Patrick Ventured333a872018-12-03 16:24:26 -08002#include "data_mock.hpp"
3#include "firmware_handler.hpp"
Patrick Venture1cc88952019-01-04 10:56:32 -08004#include "image_mock.hpp"
Patrick Venture7dad86f2019-05-17 08:52:20 -07005#include "util.hpp"
Patrick Venture3ecb3502019-05-17 11:03:51 -07006#include "verification_mock.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 = {
30 {FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
31 {FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
32 };
33
Patrick Ventured333a872018-12-03 16:24:26 -080034 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
Patrick Venture27ac5822019-05-20 17:39:31 -070035 blobs, data, CreateVerifyMock(), CreateUpdateMock());
Patrick Ventured333a872018-12-03 16:24:26 -080036
Patrick Venture1cc88952019-01-04 10:56:32 -080037 // EXPECT_EQ(handler, nullptr);
38 EXPECT_FALSE(handler == nullptr);
Patrick Ventured333a872018-12-03 16:24:26 -080039}
40
Patrick Venture1d5a31c2019-05-20 11:38:22 -070041} // namespace ipmi_flash