blob: 849d1a4611202993be04185a261a961e28f549bb [file] [log] [blame]
Jason Lingc78bfc82020-11-05 18:58:16 -08001#include "version_handler.hpp"
William A. Kennington IIIabf17352020-12-22 21:07:11 -08002#include "version_mock.hpp"
Jason Lingc78bfc82020-11-05 18:58:16 -08003
4#include <array>
William A. Kennington IIIabf17352020-12-22 21:07:11 -08005#include <utility>
Jason Lingc78bfc82020-11-05 18:58:16 -08006
7#include <gtest/gtest.h>
8
9namespace ipmi_flash
10{
11
12TEST(VersionHandlerCanHandleTest, VerifyGoodInfoMapPasses)
13{
William A. Kennington IIIabf17352020-12-22 21:07:11 -080014 constexpr std::array blobs{"blob0", "blob1"};
15 VersionBlobHandler handler(createMockVersionConfigs(blobs));
16 EXPECT_THAT(handler.getBlobIds(),
17 testing::UnorderedElementsAreArray(blobs));
18}
19
20TEST(VersionHandlerCanHandleTest, VerifyDuplicatesIgnored)
21{
22 constexpr std::array blobs{"blob0"};
23 auto configs = createMockVersionConfigs(blobs);
24 configs.push_back(createMockVersionConfig(blobs[0]));
25 VersionBlobHandler handler(std::move(configs));
26 EXPECT_THAT(handler.getBlobIds(),
27 testing::UnorderedElementsAreArray(blobs));
Jason Lingc78bfc82020-11-05 18:58:16 -080028}
29
Jason Lingc78bfc82020-11-05 18:58:16 -080030} // namespace ipmi_flash