test: firmware notYetStarted: open

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: If04fcf69b41df836c3fd0885efb9049f3e01ed81
diff --git a/test/firmware_state_notyetstarted_unittest.cpp b/test/firmware_state_notyetstarted_unittest.cpp
index 9672359..819f26a 100644
--- a/test/firmware_state_notyetstarted_unittest.cpp
+++ b/test/firmware_state_notyetstarted_unittest.cpp
@@ -12,6 +12,7 @@
 namespace
 {
 
+using ::testing::Return;
 using ::testing::UnorderedElementsAreArray;
 
 class FirmwareHandlerNotYetStartedTest : public IpmiOnlyFirmwareStaticTest
@@ -74,7 +75,33 @@
     }
 }
 
-/* open(each blob id) */
+/* open(each blob id) (verifyblobid will no longer be available at this state.
+ */
+TEST_F(FirmwareHandlerNotYetStartedTest, OpenStaticImageFileVerifyStateChange)
+{
+    std::uint16_t flags =
+        blobs::OpenFlags::write | FirmwareBlobHandler::UpdateFlags::ipmi;
+    auto realHandler = dynamic_cast<FirmwareBlobHandler*>(handler.get());
+
+    EXPECT_CALL(imageMock, open(staticLayoutBlobId)).WillOnce(Return(true));
+
+    EXPECT_TRUE(handler->open(1, flags, staticLayoutBlobId));
+    EXPECT_EQ(FirmwareBlobHandler::UpdateState::uploadInProgress,
+              realHandler->getCurrentState());
+}
+
+TEST_F(FirmwareHandlerNotYetStartedTest, OpenHashFileVerifyStateChange)
+{
+    std::uint16_t flags =
+        blobs::OpenFlags::write | FirmwareBlobHandler::UpdateFlags::ipmi;
+    auto realHandler = dynamic_cast<FirmwareBlobHandler*>(handler.get());
+
+    EXPECT_CALL(imageMock, open(hashBlobId)).WillOnce(Return(true));
+
+    EXPECT_TRUE(handler->open(1, flags, hashBlobId));
+    EXPECT_EQ(FirmwareBlobHandler::UpdateState::uploadInProgress,
+              realHandler->getCurrentState());
+}
 
 } // namespace
 } // namespace ipmi_flash