blob: 338e7bfd14a7106849c0658a06f0ba002333a02d [file] [log] [blame]
Patrick Venture46637c82018-11-06 15:20:24 -08001#include "firmware_handler.hpp"
Patrick Venturea78e39f2018-11-06 18:37:06 -08002#include "image_mock.hpp"
Patrick Venture46637c82018-11-06 15:20:24 -08003
Patrick Venturea78e39f2018-11-06 18:37:06 -08004#include <vector>
Patrick Venture46637c82018-11-06 15:20:24 -08005
6#include <gtest/gtest.h>
7
8namespace blobs
9{
10TEST(FirmwareHandlerStatTest, StatOnInactiveBlobIDReturnsTransport)
11{
12 /* Test that the metadata information returned matches expectations for this
13 * case.
14 *
15 * canHandle has already been called at this point, so we don't need to test
16 * the input for this function.
17 */
18
Patrick Venturea78e39f2018-11-06 18:37:06 -080019 ImageHandlerMock imageMock;
20
21 std::vector<HandlerPack> blobs = {
Patrick Venture18235e62018-11-08 10:21:09 -080022 {FirmwareBlobHandler::hashBlobID, &imageMock},
Patrick Venturea78e39f2018-11-06 18:37:06 -080023 {"asdf", &imageMock},
24 };
Patrick Venture1cde5f92018-11-07 08:26:47 -080025 std::vector<DataHandlerPack> data = {
Patrick Venture05abf7e2018-11-09 11:02:56 -080026 {FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
Patrick Venture1cde5f92018-11-07 08:26:47 -080027 };
Patrick Venturea78e39f2018-11-06 18:37:06 -080028
Patrick Venture1cde5f92018-11-07 08:26:47 -080029 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(blobs, data);
Patrick Venture46637c82018-11-06 15:20:24 -080030 struct BlobMeta meta;
31 EXPECT_TRUE(handler->stat("asdf", &meta));
Patrick Venture05abf7e2018-11-09 11:02:56 -080032 EXPECT_EQ(FirmwareBlobHandler::UpdateFlags::ipmi, meta.blobState);
Patrick Venture46637c82018-11-06 15:20:24 -080033}
34
35} // namespace blobs