test: firmware updateInProgress: write
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ica36dd2520bbbb09bd5b31907e62a9de1d6c12b1
diff --git a/test/firmware_state_uploadinprogress_unittest.cpp b/test/firmware_state_uploadinprogress_unittest.cpp
index dda95ee..6b0394a 100644
--- a/test/firmware_state_uploadinprogress_unittest.cpp
+++ b/test/firmware_state_uploadinprogress_unittest.cpp
@@ -6,6 +6,10 @@
#include "firmware_handler.hpp"
#include "firmware_unittest.hpp"
+#include <cstdint>
+#include <string>
+#include <vector>
+
#include <gtest/gtest.h>
namespace ipmi_flash
@@ -13,6 +17,7 @@
namespace
{
+using ::testing::ContainerEq;
using ::testing::Return;
using ::testing::UnorderedElementsAreArray;
@@ -248,7 +253,28 @@
/*
* write(session)
+ */
+TEST_F(FirmwareHandlerUploadInProgressTest, WriteToImageReturnsSuccess)
+{
+ openToInProgress(staticLayoutBlobId);
+ std::vector<std::uint8_t> bytes = {0x01, 0x02};
+ EXPECT_CALL(imageMock, write(0, ContainerEq(bytes))).WillOnce(Return(true));
+ EXPECT_TRUE(handler->write(session, 0, bytes));
+}
+
+TEST_F(FirmwareHandlerUploadInProgressTest, WriteToHashReturnsSuccess)
+{
+ openToInProgress(hashBlobId);
+ std::vector<std::uint8_t> bytes = {0x01, 0x02};
+ EXPECT_CALL(imageMock, write(0, ContainerEq(bytes))).WillOnce(Return(true));
+ EXPECT_TRUE(handler->write(session, 0, bytes));
+}
+
+/*
* read(session)
+ */
+
+/*
* commit(session)
*/