summaryrefslogtreecommitdiffstats
path: root/bmc/test/firmware_stat_unittest.cpp
blob: 99ae770b91b7f7add45f8c32a1b265c168e62fdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "triggerable_mock.hpp"
#include "util.hpp"

#include <vector>

#include <gtest/gtest.h>

namespace ipmi_flash
{
TEST(FirmwareHandlerStatTest, StatOnInactiveBlobIDReturnsTransport)
{
    /* Test that the metadata information returned matches expectations for this
     * case.
     *
     * canHandle has already been called at this point, so we don't need to test
     * the input for this function.
     */

    ImageHandlerMock imageMock;

    std::vector<HandlerPack> blobs = {
        {hashBlobId, &imageMock},
        {"asdf", &imageMock},
    };
    std::vector<DataHandlerPack> data = {
        {FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
    };

    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
        blobs, data, CreateTriggerMock(), CreateTriggerMock(),
        CreateTriggerMock());

    blobs::BlobMeta meta;
    EXPECT_TRUE(handler->stat("asdf", &meta));
    EXPECT_EQ(FirmwareBlobHandler::UpdateFlags::ipmi, meta.blobState);
}

} // namespace ipmi_flash
OpenPOWER on IntegriCloud