Patrick Venture | 1d66fe6 | 2019-06-03 14:57:27 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | fa06a5f | 2019-07-01 09:22:38 -0700 | [diff] [blame] | 3 | #include "firmware_handler.hpp" |
Patrick Venture | 1d66fe6 | 2019-06-03 14:57:27 -0700 | [diff] [blame] | 4 | #include "status.hpp" |
| 5 | |
Patrick Venture | fa06a5f | 2019-07-01 09:22:38 -0700 | [diff] [blame] | 6 | #include <memory> |
| 7 | #include <string> |
| 8 | |
Patrick Venture | da4d4a4 | 2020-09-28 11:41:05 -0700 | [diff] [blame] | 9 | #include <gmock/gmock.h> |
Patrick Venture | 1d66fe6 | 2019-06-03 14:57:27 -0700 | [diff] [blame] | 10 | #include <gtest/gtest.h> |
| 11 | |
| 12 | namespace ipmi_flash |
| 13 | { |
| 14 | // TriggerableActionInterface |
| 15 | |
| 16 | class TriggerMock : public TriggerableActionInterface |
| 17 | { |
| 18 | public: |
| 19 | MOCK_METHOD0(trigger, bool()); |
| 20 | MOCK_METHOD0(abort, void()); |
| 21 | MOCK_METHOD0(status, ActionStatus()); |
| 22 | }; |
| 23 | |
| 24 | std::unique_ptr<TriggerableActionInterface> CreateTriggerMock() |
| 25 | { |
| 26 | return std::make_unique<TriggerMock>(); |
| 27 | } |
| 28 | |
Patrick Venture | fa06a5f | 2019-07-01 09:22:38 -0700 | [diff] [blame] | 29 | ActionMap CreateActionMap(const std::string& blobPath) |
| 30 | { |
| 31 | std::unique_ptr<ActionPack> actionPack = std::make_unique<ActionPack>(); |
Patrick Venture | da4d4a4 | 2020-09-28 11:41:05 -0700 | [diff] [blame] | 32 | actionPack->preparation = CreateTriggerMock(); |
| 33 | actionPack->verification = CreateTriggerMock(); |
| 34 | actionPack->update = CreateTriggerMock(); |
Patrick Venture | fa06a5f | 2019-07-01 09:22:38 -0700 | [diff] [blame] | 35 | |
| 36 | ActionMap map; |
| 37 | map[blobPath] = std::move(actionPack); |
| 38 | return map; |
| 39 | } |
| 40 | |
Patrick Venture | 1d66fe6 | 2019-06-03 14:57:27 -0700 | [diff] [blame] | 41 | } // namespace ipmi_flash |