bmc: delete if open sessions bails

Handle case where one tries to delete any blob while a blob is open.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I4407d46f7a87c42f7d2738668e72e58a847b60af
diff --git a/test/firmware_state_uploadinprogress_unittest.cpp b/test/firmware_state_uploadinprogress_unittest.cpp
index 5ed5491..c45861d 100644
--- a/test/firmware_state_uploadinprogress_unittest.cpp
+++ b/test/firmware_state_uploadinprogress_unittest.cpp
@@ -269,5 +269,22 @@
     EXPECT_FALSE(handler->commit(session, {}));
 }
 
+/*
+ * deleteBlob(blob)
+ */
+TEST_F(FirmwareHandlerUploadInProgressTest, DeleteBlobReturnsFalse)
+{
+    /* Try deleting all blobs, it doesn't really matter which though because you
+     * cannot close out an open session, therefore you must fail to delete
+     * anything unless everything is closed.
+     */
+    openToInProgress(staticLayoutBlobId);
+    auto blobs = handler->getBlobIds();
+    for (const auto& b : blobs)
+    {
+        EXPECT_FALSE(handler->deleteBlob(b));
+    }
+}
+
 } // namespace
 } // namespace ipmi_flash