blob: 34691271727c82444febe31633a35c05965bd6b3 [file] [log] [blame]
Patrick Venture1d66fe62019-06-03 14:57:27 -07001#pragma once
2
Patrick Venturefa06a5f2019-07-01 09:22:38 -07003#include "firmware_handler.hpp"
Patrick Venture1d66fe62019-06-03 14:57:27 -07004#include "status.hpp"
5
Patrick Venturefa06a5f2019-07-01 09:22:38 -07006#include <memory>
7#include <string>
8
Patrick Ventureda4d4a42020-09-28 11:41:05 -07009#include <gmock/gmock.h>
Patrick Venture1d66fe62019-06-03 14:57:27 -070010#include <gtest/gtest.h>
11
12namespace ipmi_flash
13{
14// TriggerableActionInterface
15
16class TriggerMock : public TriggerableActionInterface
17{
18 public:
19 MOCK_METHOD0(trigger, bool());
20 MOCK_METHOD0(abort, void());
21 MOCK_METHOD0(status, ActionStatus());
22};
23
24std::unique_ptr<TriggerableActionInterface> CreateTriggerMock()
25{
26 return std::make_unique<TriggerMock>();
27}
28
Patrick Venturefa06a5f2019-07-01 09:22:38 -070029ActionMap CreateActionMap(const std::string& blobPath)
30{
31 std::unique_ptr<ActionPack> actionPack = std::make_unique<ActionPack>();
Patrick Ventureda4d4a42020-09-28 11:41:05 -070032 actionPack->preparation = CreateTriggerMock();
33 actionPack->verification = CreateTriggerMock();
34 actionPack->update = CreateTriggerMock();
Patrick Venturefa06a5f2019-07-01 09:22:38 -070035
36 ActionMap map;
37 map[blobPath] = std::move(actionPack);
38 return map;
39}
40
Patrick Venture1d66fe62019-06-03 14:57:27 -070041} // namespace ipmi_flash